Skip to content

Commit

Permalink
清晰度菜单优化
Browse files Browse the repository at this point in the history
  • Loading branch information
haocity committed Mar 5, 2018
1 parent 0327992 commit abb7b64
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 51 deletions.
Binary file modified chrome/chrome.zip
Binary file not shown.
Binary file modified chrome/dist.crx
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"description": "TDPLAYER",
"manifest_version": 2,
"name": "TDlayer",
"version": "1.2.5.0",
"version": "1.3.0.0",
"author":"haotown",
"homepage_url": "https://github.com/haocity/tdplayer/tree/extend",
"content_scripts": [
Expand Down
2 changes: 1 addition & 1 deletion dist/tdplayer.js

Large diffs are not rendered by default.

88 changes: 43 additions & 45 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@ window.tdvidplay = function(options) {
}).then(function (data) {
let json=data.data
let vobj=parsevideo(json,true)
if(vobj.v1 || vobj.v2 || vobj.v3 || vobj.v4) {
videosrcarr.push(vobj);
window.a = new Tplayer({
videosrcarr.push(vobj);
window.a = new Tplayer({
Element: options.ele,
video: {
url: videosrcarr,
Expand All @@ -139,31 +138,30 @@ window.tdvidplay = function(options) {
},
acvid: options.vid,
ab:options.ab
})
}
})

}).catch((e)=>{
playerror(e)
})
}else{
fetch("https://api.haotown.cn/pyapi/vid/" + options.vid).then(function(t) {
return t.json();
}).then(function(json) {
let vobj=parsevideo(json)
let vobj = parsevideo(json)
console.log('vobj', vobj)
if(vobj.v1 || vobj.v2 || vobj.v3 || vobj.v4) {
videosrcarr.push(vobj)
window.a= new Tplayer({
Element: options.ele,
video: {
url: videosrcarr,
pic: options.pic,
type: 'hls',
autoplay: options.autoplay
},
acvid: options.vid,
ab:options.ab
});
}
videosrcarr.push(vobj)
window.a = new Tplayer({
Element: options.ele,
video: {
url: videosrcarr,
pic: options.pic,
type: 'hls',
autoplay: options.autoplay
},
acvid: options.vid,
ab: options.ab
});

}).catch((e)=>{
playerror(e)
})
Expand All @@ -186,33 +184,33 @@ window.tdvidplay = function(options) {
if(yk) {
for(let i = 0; i < json.stream.length; i++) {
if(json.stream[i].stream_type == 'mp4hd3') {
vobj.v1 = json.stream[i];
vobj.v1.v = 1;
vobj[1] = json.stream[i];
vobj[1].v = 1;
} else if(json.stream[i].stream_type == 'mp4hd2') {
vobj.v2 = json.stream[i];
vobj.v2.v = 2;
vobj[2] = json.stream[i];
vobj[2].v = 2;
} else if(json.stream[i].stream_type == 'mp4hd') {
vobj.v3 = json.stream[i];
vobj.v3.v = 3;
vobj[3] = json.stream[i];
vobj[3].v = 3;
} else if(json.stream[i].stream_type == 'flvhd') {
vobj.v4 = json.stream[i];
vobj.v4.v = 4;
vobj[4] = json.stream[i];
vobj[4].v = 4;
}
}
}else{
for(let i = 0; i < json.stream.length; i++) {
if(json.stream[i].stream_type == 'm3u8_hd3') {
vobj.v1 = json.stream[i]
vobj.v1.v = 1
vobj[1] = json.stream[i]
vobj[1].v = 1
} else if(json.stream[i].stream_type == 'm3u8_hd') {
vobj.v2 = json.stream[i]
vobj.v2.v = 2
vobj[2] = json.stream[i]
vobj[2].v = 2
} else if(json.stream[i].stream_type == 'm3u8_mp4') {
vobj.v3 = json.stream[i]
vobj.v3.v = 3
vobj[3] = json.stream[i]
vobj[3].v = 3
} else if(json.stream[i].stream_type == 'm3u8_flv') {
vobj.v4 = json.stream[i]
vobj.v4.v = 4
vobj[4] = json.stream[i]
vobj[4].v = 4
}
}
}
Expand Down Expand Up @@ -317,7 +315,6 @@ class Tplayer {
let vv, ele;
ele = document.createElement('ul')
for(let i in src[0]) {
console.log(i)
if(src[0][i].v == t) {
vv = src[0][i]
}
Expand Down Expand Up @@ -351,14 +348,14 @@ class Tplayer {
ele.appendChild(li);
}
if(!vv) {
if(src[0].v1) {
vv = src[0].v1
} else if(src[0].v2) {
vv = src[0].v2
} else if(src[0].v3) {
vv = src[0].v3
} else if(src[0].v4) {
vv = src[0].v4
if(src[0][1]) {
vv = src[0][1]
} else if(src[0][2]) {
vv = src[0][2]
} else if(src[0][3]) {
vv = src[0][3]
} else if(src[0][4]) {
vv = src[0][4]
}
}
this.videosrcarr = [vv.m3u8]
Expand Down Expand Up @@ -1869,6 +1866,7 @@ class Tplayer {
}
}
}

}
}
//返回当前播放段
Expand Down
8 changes: 4 additions & 4 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ section.player{
right: 10px;
top: 10px;
width: 360px;
height: 230px;
height: 208px;
z-index: 99;
}
.tp-video-warp.tp-video-warp-fixed:hover>.tp-video-main>.tp-drag{
Expand Down Expand Up @@ -183,9 +183,9 @@ section.player{
.danmaku-ad{
position: absolute;
white-space: nowrap;
-webkit-transform: translateX(50%);
-moz-transform: translateX(50%);
transform: translateX(50%);
-webkit-transform: translate(50%,50%);
-moz-transform: translate(50%,50%);
transform: translate(50%,50%);
}
@keyframes dmleft {
0% {
Expand Down

0 comments on commit abb7b64

Please sign in to comment.