The essence of the problem is the following, there is a player of the radio stations catalog http://radiomaniya.ru/player.php?id=optimistfm which is placed on HTML 5, when it is put on the site, it immediately connects the user to the stream, although the user who visited the site does not included it even turns out cheat listeners ...

Help solve the problem ...

  • radiomania.ru is your website? - zb '
  • @eicto, it is logical that not. - Zhukov Roman
  • Well, naturally, my, according to yours, I asked a similar question here =) - Alexander Sizintsev
  • @Zhukov Roman can see, sometimes the logic does not work, remove the answer plz, so as not to mislead the people who are boozing - zb '14
  • @eicto, thanks. Strange, his site, but can not figure it out. - Zhukov Roman

1 answer 1

do not immediately expose src:

HTML:

<audio id="audio-player" src="#" data-src="http://radio.trance-life.ru:8000/ambient192mp3" type="audio/mp3" controls="controls" preload="auto" autobuffer></audio> 

Script change like this:

Js:

 $(document).ready(function () { var real_src=$('#audio-player').data('src'); //запоминаем data-src //в real_src player = new MediaElementPlayer('#audio-player', { alwaysShowControls: true, features: ['playpause', 'volume'], audioVolume: 'horizontal', audioWidth: 200, audioHeight: 50, startVolume: 0.5 }); $('.audio-player .mejs-play').one('click', function () { //первый раз console.log(real_src); //по кнопке play player.setSrc(real_src); //выставляем src player.play(); return false; }); }); 

Demo

  • Sorry for the little buggy question: in the sense of what it means - do not immediately expose src? - Alexander Sizintsev
  • in the audio element, I updated the answer, it seems to work, it can look in the browser's network console. - zb '
  • btw, you have half the default volume there, there can be considerable distortions from the soft mixer (I have recently tested the speakers, and changing the volume in the web players smears the sound a bit) - zb '14
  • to further reduce the server load, put the script in the jquery and mediaelement file and take cdn jsdelivr.com/#!mediaelement jsdelivr.com/#!jquery - zb '14