mirror of
https://github.com/torappinfo/uweb.git
synced 2024-08-14 23:54:59 +00:00
rebuilding site Fri Aug 20 08:43:07 AM CST 2021
This commit is contained in:
parent
0839e80356
commit
4875063dc5
2 changed files with 47 additions and 1 deletions
|
@ -23,7 +23,7 @@
|
|||
<ul class="tags">
|
||||
|
||||
</ul>
|
||||
<p><a target="_self" href="i:0h/sdcard/uweb/app/plyr.html:https://jamesfengcao.gitee.io/uwebzh/searchurl/txt/plyr.html">点击安装plyr视频播放器</a><br>
|
||||
<p><a target="_self" href="i:0h/sdcard/uweb/app/plyr.html:https://jamesfengcao.gitee.io/uwebzh/searchurl/txt/plyr.cfg">点击安装plyr视频播放器</a><br>
|
||||
<a target="_self" href="i:0h/sdcard/uweb/app/dplayer.html:https://jamesfengcao.gitee.io/uwebzh/searchurl/txt/dplayer.html">点击安装dplayer视频播放器</a><br>
|
||||
<a target="_self" href="i:0h/sdcard/uweb/app/pdfviewer.html:https://jamesfengcao.gitee.io/uwebzh/searchurl/txt/pdfviewer.html">点击安装pdf阅读器</a><br>
|
||||
<a target="_self" href="i:0h/sdcard/uweb/app/epub.html:https://jamesfengcao.gitee.io/uwebzh/searchurl/txt/epub.html">点击安装epub阅读器</a><br>
|
||||
|
|
46
searchurl/txt/plyr.cfg
Normal file
46
searchurl/txt/plyr.cfg
Normal file
|
@ -0,0 +1,46 @@
|
|||
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/plyr/dist/plyr.css"/>
|
||||
<video id="player" playsinline controls
|
||||
data-plyr-config='{"controls": ["play-large", "play", "progress", "current-time", "settings", "fullscreen"] }'>
|
||||
<source id="src" />
|
||||
</video>
|
||||
<script src="https://cdn.jsdelivr.net/npm/plyr"></script>
|
||||
<script src="https://cdn.jsdelivr.net/hls.js/latest/hls.js"></script>
|
||||
<script>
|
||||
const source = location.search.substring(3);
|
||||
document.getElementById("src").src = source;
|
||||
const video = document.querySelector("video");
|
||||
let i = source.indexOf(".m3u8");
|
||||
if(i>0 &&
|
||||
(source.length <= (i+5) || '?'===source.charAt(i+5)))
|
||||
{
|
||||
const hls = new Hls();
|
||||
hls.loadSource(source);
|
||||
const defaultOptions = {};
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, function (event, data) {
|
||||
const availableQualities = hls.levels.map((l) => l.height);
|
||||
defaultOptions.quality = {
|
||||
default: availableQualities[0],
|
||||
options: availableQualities,
|
||||
forced: true,
|
||||
onChange: (e) => updateQuality(e),
|
||||
}
|
||||
|
||||
// Initialize new Plyr player with quality options
|
||||
const player = new Plyr(video, defaultOptions);
|
||||
});
|
||||
hls.attachMedia(video);
|
||||
window.hls = hls;
|
||||
} else {
|
||||
const player = new Plyr(video);
|
||||
}
|
||||
|
||||
function updateQuality(newQuality) {
|
||||
window.hls.levels.forEach((level, levelIndex) => {
|
||||
if (level.height === newQuality) {
|
||||
console.log("Found quality match with " + newQuality);
|
||||
window.hls.currentLevel = levelIndex;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
Loading…
Reference in a new issue