mirror of
https://github.com/torappinfo/uweb.git
synced 2024-08-14 23:54:59 +00:00
rebuilding site Thu Oct 1 08:36:36 PM CST 2020
This commit is contained in:
parent
fecb1941e2
commit
130c7382e8
2 changed files with 28 additions and 10 deletions
|
@ -1,21 +1,22 @@
|
||||||
|
<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"/>
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/plyr/dist/plyr.css"/>
|
||||||
<video id="player" playsinline controls>
|
<video id="player" playsinline controls
|
||||||
|
data-plyr-config='{"controls": ["play-large", "play", "progress", "current-time", "settings", "fullscreen"] }'>
|
||||||
<source id="src" />
|
<source id="src" />
|
||||||
</video>
|
</video>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/plyr"></script>
|
<script src="https://cdn.jsdelivr.net/npm/plyr"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/hls.js/latest/hls.js"></script>
|
<script src="https://cdn.jsdelivr.net/hls.js/latest/hls.js"></script>
|
||||||
<script>
|
<script>
|
||||||
const source = location.search.substring(3);//?u=
|
const source = location.search.substring(3);
|
||||||
{
|
document.getElementById("src").src = source;
|
||||||
let d = document;
|
|
||||||
let e = d.getElementById("src");
|
|
||||||
e.src = source;
|
|
||||||
}
|
|
||||||
const video = document.querySelector("video");
|
const video = document.querySelector("video");
|
||||||
const defaultOptions = {};
|
let i = source.indexOf(".m3u8");
|
||||||
if (Hls.isSupported()) {
|
if(i>0 &&
|
||||||
|
(source.length <= (i+5) || '?'===source.charAt(i+5)))
|
||||||
|
{
|
||||||
const hls = new Hls();
|
const hls = new Hls();
|
||||||
hls.loadSource(source);
|
hls.loadSource(source);
|
||||||
|
const defaultOptions = {};
|
||||||
hls.on(Hls.Events.MANIFEST_PARSED, function (event, data) {
|
hls.on(Hls.Events.MANIFEST_PARSED, function (event, data) {
|
||||||
const availableQualities = hls.levels.map((l) => l.height);
|
const availableQualities = hls.levels.map((l) => l.height);
|
||||||
defaultOptions.quality = {
|
defaultOptions.quality = {
|
||||||
|
@ -31,7 +32,7 @@
|
||||||
hls.attachMedia(video);
|
hls.attachMedia(video);
|
||||||
window.hls = hls;
|
window.hls = hls;
|
||||||
} else {
|
} else {
|
||||||
const player = new Plyr(video, defaultOptions);
|
const player = new Plyr(video);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateQuality(newQuality) {
|
function updateQuality(newQuality) {
|
||||||
|
|
17
searchurl/txt/videojs.html
Normal file
17
searchurl/txt/videojs.html
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/video.js/dist/video-js.min.css"/>
|
||||||
|
<video
|
||||||
|
id="player"
|
||||||
|
class="video-js"
|
||||||
|
preload="auto"
|
||||||
|
controls >
|
||||||
|
<source id="src" />
|
||||||
|
</video>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/video.js/dist/video.min.js"></script>
|
||||||
|
<script>
|
||||||
|
const source = location.search.substring(3);
|
||||||
|
document.getElementById("src").src = source;
|
||||||
|
let setup = {
|
||||||
|
playbackRates: [0.5, 1, 1.25, 1.5, 2, 4],
|
||||||
|
};
|
||||||
|
let player = videojs('player',setup);
|
||||||
|
</script>
|
Loading…
Reference in a new issue