-
Notifications
You must be signed in to change notification settings - Fork 586
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b175768
commit c0f0990
Showing
2 changed files
with
28 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
* @date 2019.8.3 | ||
*/ | ||
mashiro_global.variables = new function () { | ||
this.has_hls = false; | ||
this.skinSecter = true; | ||
} | ||
mashiro_global.ini = new function () { | ||
|
@@ -523,25 +524,34 @@ function killCoverVideo() { | |
} | ||
} | ||
|
||
function loadHls(){ | ||
var video = addComment.I('coverVideo'); | ||
var video_src = $('#coverVideo').attr('data-src'); | ||
if (Hls.isSupported()) { | ||
var hls = new Hls(); | ||
hls.loadSource(video_src); | ||
hls.attachMedia(video); | ||
hls.on(Hls.Events.MANIFEST_PARSED, function () { | ||
video.play(); | ||
}); | ||
} else if (video.canPlayType('application/vnd.apple.mpegurl')) { | ||
video.src = video_src; | ||
video.addEventListener('loadedmetadata', function () { | ||
video.play(); | ||
}); | ||
} | ||
} | ||
|
||
function coverVideoIni() { | ||
if ($('video').hasClass('hls')) { | ||
$.getScript("https://cdn.jsdelivr.net/gh/mashirozx/[email protected]/cdn/js/src/16.hls.js", function(){ | ||
var video = addComment.I('coverVideo'); | ||
var video_src = $('#coverVideo').attr('data-src'); | ||
if (Hls.isSupported()) { | ||
var hls = new Hls(); | ||
hls.loadSource(video_src); | ||
hls.attachMedia(video); | ||
hls.on(Hls.Events.MANIFEST_PARSED, function () { | ||
video.play(); | ||
}); | ||
} else if (video.canPlayType('application/vnd.apple.mpegurl')) { | ||
video.src = video_src; | ||
video.addEventListener('loadedmetadata', function () { | ||
video.play(); | ||
}); | ||
} | ||
}); | ||
if (mashiro_global.variables.has_hls){ | ||
loadHls(); | ||
}else{ | ||
$.getScript("https://cdn.jsdelivr.net/gh/mashirozx/[email protected]/cdn/js/src/16.hls.js", function(){ | ||
loadHls(); | ||
mashiro_global.variables.has_hls = true; | ||
}); | ||
} | ||
//console.info('ini:coverVideoIni()'); | ||
} | ||
} | ||
|