fix quality

master
iotcat 4 years ago
parent 6685dbace5
commit 5f9ac31454
  1. 39
      index.html

@ -189,12 +189,7 @@
var isWaiting = false; var isWaiting = false;
$.get("https://acg.watch/api/getVideoByUrl?url="+page.params.url, function(res){ $.get("https://acg.watch/api/getVideoByUrl?url="+page.params.url, function(res){
//res = JSON.parse(res); //res = JSON.parse(res);
options.video.quality = [ options.video.quality = getQuality(res);
{
name: '推荐',
url: res.url
}
];
options.danmaku.id = res.danmakuID; options.danmaku.id = res.danmakuID;
dp = new DPlayer(options); dp = new DPlayer(options);
/* recover history playing */ /* recover history playing */
@ -233,24 +228,14 @@
page.params.url = res.url; page.params.url = res.url;
//res2 = JSON.parse(res2); //res2 = JSON.parse(res2);
options.video.quality = [ options.video.quality = getQuality(res);
{
name: "推荐",
url: res.url
}
];
options.danmaku.id = res.danmakuID; options.danmaku.id = res.danmakuID;
options.video.defaultQuality = 0; options.video.defaultQuality = 0;
options.video.playFrom = 0; options.video.playFrom = 0;
dp.switchVideo( dp.switchVideo(
{ {
url: res.url, url: res.url,
quality: [ quality: getQuality(res),
{
name: "推荐",
url: res.url
}
],
defaultQuality: 0 defaultQuality: 0
}, },
{ {
@ -271,6 +256,24 @@
}, 2000); }, 2000);
}); });
} }
var getQuality = function(res){
var quality = [
{
name: "推荐",
url: res.url
}
];
if(res.hasOwnProperty('extra') && res.extra.length > 0){
for(var i = 0; i < res.extra.length; i++){
quality.push({
name: "备选"+i,
url: res.extra[i]
});
}
}
return quality;
}
var getInfo = function(res){ var getInfo = function(res){
printInfo(res); printInfo(res);
} }

Loading…
Cancel
Save