我正在为网站制作广播脚本。可以在PC,iPhone和Windows Phone上的任何浏览器上播放正常。在android上,播放会在播放20到40秒后停止,没有任何可见的错误。我在服务器fleet.az/radio
上做了一个小测试页var stations =
{
Gospel:
{
url: "http://91.226.107.45:8000/gospel",
fallback: "http://newradio.biz:8000/gospel_m",
howl: null
}
};
function play(stationName) {
//Get station object from stations variable
var station = stations[stationName];
//Internal station object to manipulate with stream
var sound;
//Checking if station object not null and is loaded
//If not loaded unload other stations and initialise stream and load
if (station.howl && (station.howl._state == "loaded")) {
sound = station.howl;
} else {
//unload other stations
Howler.unload();
//initialize stream
sound = station.howl = new Howl({
src: [station.url, station.fallback],
html5: true,
buffer: false,
format: ['aac', 'mp3']
}
//Pause all playing stations
pauseEverything();
//Start playing station
sound.play();
//Return stream object to stations variable
stations[stationName].howl = sound;
}