Spaces:
Running
Running
Edit vidstack.html
Browse files- 256x144.png +0 -0
- plyr_test_0002.html +163 -0
- plyr_test_0003.html +43 -0
- vidstack.html +80 -50
256x144.png
ADDED
|
plyr_test_0002.html
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<link rel="preconnect" href="https://rsms.me/">
|
| 7 |
+
<link rel="stylesheet" href="https://rsms.me/inter/inter.css">
|
| 8 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 9 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 10 |
+
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
|
| 11 |
+
<script src="https://cdn.plyr.io/3.7.8/plyr.js"></script>
|
| 12 |
+
<link rel="stylesheet" href="https://cdn.plyr.io/3.7.8/plyr.css" />
|
| 13 |
+
<style>
|
| 14 |
+
:root { font-family: 'Inter', sans-serif; }
|
| 15 |
+
@supports (font-variation-settings: normal) {
|
| 16 |
+
:root { font-family: 'Inter var', sans-serif; }
|
| 17 |
+
}
|
| 18 |
+
body {
|
| 19 |
+
margin: 0;
|
| 20 |
+
background-color: #000000;
|
| 21 |
+
width: 100vw;
|
| 22 |
+
height: 100vh;
|
| 23 |
+
font-family: 'Inter', 'Noto Sans JP', sans-serif;
|
| 24 |
+
}
|
| 25 |
+
.wrapper {
|
| 26 |
+
height: 100vh;
|
| 27 |
+
display: flex;
|
| 28 |
+
flex-direction: column;
|
| 29 |
+
}
|
| 30 |
+
#player, .plyr {
|
| 31 |
+
flex-grow: 1;
|
| 32 |
+
height: 100%;
|
| 33 |
+
width: 100%;
|
| 34 |
+
}
|
| 35 |
+
footer.copyrightDisp {
|
| 36 |
+
display: none;
|
| 37 |
+
position: fixed;
|
| 38 |
+
left: 0;
|
| 39 |
+
bottom: 0;
|
| 40 |
+
padding: 0;
|
| 41 |
+
margin: 0 0 10px 10px;
|
| 42 |
+
color: #ffffff80;
|
| 43 |
+
z-index: 2;
|
| 44 |
+
user-select: none;
|
| 45 |
+
}
|
| 46 |
+
</style>
|
| 47 |
+
</head>
|
| 48 |
+
<body>
|
| 49 |
+
<div class="wrapper">
|
| 50 |
+
<video id="player" playsinline controls>
|
| 51 |
+
</video>
|
| 52 |
+
</div>
|
| 53 |
+
<footer class="copyrightDisp">
|
| 54 |
+
Resources are created for research purposes.<br>
|
| 55 |
+
(C) 2023 Tappei Nagatsuki, KADOKAWA, daydreamer-json
|
| 56 |
+
</footer>
|
| 57 |
+
<script>
|
| 58 |
+
const plyrOptions = {
|
| 59 |
+
enabled: true,
|
| 60 |
+
debug: false,
|
| 61 |
+
controls: ['play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', 'fullscreen'],
|
| 62 |
+
settings: ['captions', 'quality', 'speed', 'loop'],
|
| 63 |
+
blankVideo: 'https://cdn.plyr.io/static/blank.mp4',
|
| 64 |
+
autoplay: false,
|
| 65 |
+
autopause: true,
|
| 66 |
+
playsinline: true,
|
| 67 |
+
volume: 1,
|
| 68 |
+
muted: false,
|
| 69 |
+
clickToPlay: true,
|
| 70 |
+
disableContextMenu: true,
|
| 71 |
+
hideControls: true,
|
| 72 |
+
resetOnEnd: false,
|
| 73 |
+
keyboard: { focused: true, global: false },
|
| 74 |
+
tooltips: { controls: true, seek: true },
|
| 75 |
+
displayDuration: true,
|
| 76 |
+
invertTime: true,
|
| 77 |
+
toggleInvert: true,
|
| 78 |
+
captions: { active: false, language: 'auto', update: false },
|
| 79 |
+
fullscreen: { enabled: true, fallback: true, iosNative: false, container: null },
|
| 80 |
+
storage: { enabled: true, key: 'plyr' },
|
| 81 |
+
speed: { selected: 1, options: [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4] },
|
| 82 |
+
quality: { default: 1080, options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240, 144] },
|
| 83 |
+
loop: { active: false },
|
| 84 |
+
previewThumbnails: { enabled: false, src: '' },
|
| 85 |
+
mediaMetadata: { title: '', artist: '', album: '', artwork: [] },
|
| 86 |
+
title: '',
|
| 87 |
+
i18n: {
|
| 88 |
+
"restart": "再起動",
|
| 89 |
+
"rewind": "{seektime}秒戻る",
|
| 90 |
+
"play": "再生",
|
| 91 |
+
"pause": "一時停止",
|
| 92 |
+
"fastForward": "{seektime}秒進む",
|
| 93 |
+
"seek": "シーク",
|
| 94 |
+
"seekLabel": "{currentTime} / {duration}",
|
| 95 |
+
"played": "再生中",
|
| 96 |
+
"buffered": "読み込み中",
|
| 97 |
+
"currentTime": "再生位置",
|
| 98 |
+
"duration": "長さ",
|
| 99 |
+
"volume": "音量",
|
| 100 |
+
"mute": "ミュート",
|
| 101 |
+
"unmute": "ミュート解除",
|
| 102 |
+
"enableCaptions": "字幕オン",
|
| 103 |
+
"disableCaptions": "字幕オフ",
|
| 104 |
+
"download": "ダウンロード",
|
| 105 |
+
"enterFullscreen": "全画面表示",
|
| 106 |
+
"exitFullscreen": "全画面表示を終了",
|
| 107 |
+
"frameTitle": "{title}",
|
| 108 |
+
"captions": "字幕",
|
| 109 |
+
"settings": "設定",
|
| 110 |
+
"pip": "ピクチャインピクチャ",
|
| 111 |
+
"menuBack": "前のメニューに戻る",
|
| 112 |
+
"speed": "速度",
|
| 113 |
+
"normal": "標準",
|
| 114 |
+
"quality": "画質",
|
| 115 |
+
"loop": "ループ",
|
| 116 |
+
"start": "開始",
|
| 117 |
+
"end": "終了",
|
| 118 |
+
"all": "すべて",
|
| 119 |
+
"reset": "リセット",
|
| 120 |
+
"disabled": "無効",
|
| 121 |
+
"enabled": "有効",
|
| 122 |
+
"advertisement": "広告",
|
| 123 |
+
"qualityBadge": {
|
| 124 |
+
"2160": "4K",
|
| 125 |
+
"1440": "HD",
|
| 126 |
+
"1080": "HD",
|
| 127 |
+
"720": "HD",
|
| 128 |
+
"576": "SD",
|
| 129 |
+
"480": "SD"
|
| 130 |
+
}
|
| 131 |
+
}
|
| 132 |
+
};
|
| 133 |
+
const player = new Plyr('#player', plyrOptions);
|
| 134 |
+
const videoFileName = 'Cs_LQ1101502_ShenheBattle_Girl';
|
| 135 |
+
player.source = {
|
| 136 |
+
type: 'video',
|
| 137 |
+
title: 're_zero_s2_sp_nc_op',
|
| 138 |
+
sources: [
|
| 139 |
+
{
|
| 140 |
+
src: `https://huggingface.co/datasets/DeliberatorArchiver/gi_cutscn_new_mux/resolve/main/media/mux/variant/hevc_240p_aac_128k/${videoFileName}.mp4`,
|
| 141 |
+
size: 240,
|
| 142 |
+
},
|
| 143 |
+
{
|
| 144 |
+
src: `https://huggingface.co/datasets/DeliberatorArchiver/gi_cutscn_new_mux/resolve/main/media/mux/variant/hevc_360p_aac_128k/${videoFileName}.mp4`,
|
| 145 |
+
size: 360,
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
src: `https://huggingface.co/datasets/DeliberatorArchiver/gi_cutscn_new_mux/resolve/main/media/mux/variant/hevc_480p_aac_128k/${videoFileName}.mp4`,
|
| 149 |
+
size: 480,
|
| 150 |
+
},
|
| 151 |
+
{
|
| 152 |
+
src: `https://huggingface.co/datasets/DeliberatorArchiver/gi_cutscn_new_mux/resolve/main/media/mux/variant/hevc_720p_aac_256k/${videoFileName}.mp4`,
|
| 153 |
+
size: 720,
|
| 154 |
+
},
|
| 155 |
+
{
|
| 156 |
+
src: `https://huggingface.co/datasets/DeliberatorArchiver/gi_cutscn_new_mux/resolve/main/media/mux/variant/hevc_1080p_aac_256k/${videoFileName}.mp4`,
|
| 157 |
+
size: 1080,
|
| 158 |
+
}
|
| 159 |
+
]
|
| 160 |
+
};
|
| 161 |
+
</script>
|
| 162 |
+
</body>
|
| 163 |
+
</html>
|
plyr_test_0003.html
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<link rel="preconnect" href="https://rsms.me/">
|
| 7 |
+
<link rel="stylesheet" href="https://rsms.me/inter/inter.css">
|
| 8 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 9 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 10 |
+
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
|
| 11 |
+
<style>
|
| 12 |
+
:root { font-family: 'Inter', sans-serif; }
|
| 13 |
+
@supports (font-variation-settings: normal) {
|
| 14 |
+
:root { font-family: 'Inter var', sans-serif; }
|
| 15 |
+
}
|
| 16 |
+
body {
|
| 17 |
+
margin: 0;
|
| 18 |
+
background-color: #000000;
|
| 19 |
+
width: 100vw;
|
| 20 |
+
height: 100vh;
|
| 21 |
+
font-family: 'Inter', 'Noto Sans JP', sans-serif;
|
| 22 |
+
}
|
| 23 |
+
.wrapper {
|
| 24 |
+
height: 100vh;
|
| 25 |
+
display: flex;
|
| 26 |
+
flex-direction: column;
|
| 27 |
+
}
|
| 28 |
+
#player {
|
| 29 |
+
flex-grow: 1;
|
| 30 |
+
height: 100%;
|
| 31 |
+
width: 100%;
|
| 32 |
+
}
|
| 33 |
+
</style>
|
| 34 |
+
</head>
|
| 35 |
+
<body>
|
| 36 |
+
<div class="wrapper">
|
| 37 |
+
<video id="player" playsinline controls src="https://huggingface.co/datasets/DeliberatorArchiver/gi_cutscn_new_mux/resolve/main/media/mux/variant/hevc_1080p_aac_256k/Cs_LQ1101502_ShenheBattle_Girl.mp4">
|
| 38 |
+
</video>
|
| 39 |
+
</div>
|
| 40 |
+
<script>
|
| 41 |
+
</script>
|
| 42 |
+
</body>
|
| 43 |
+
</html>
|
vidstack.html
CHANGED
|
@@ -9,9 +9,11 @@
|
|
| 9 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 10 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 11 |
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
|
| 12 |
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vidstack/styles/
|
| 13 |
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vidstack/styles/
|
| 14 |
-
<script
|
|
|
|
|
|
|
| 15 |
<style>
|
| 16 |
:root { font-family: 'Inter', sans-serif; }
|
| 17 |
@supports (font-variation-settings: normal) {
|
|
@@ -36,33 +38,35 @@
|
|
| 36 |
height: 100%;
|
| 37 |
width: 100%;
|
| 38 |
font-family: 'Inter', 'Noto Sans JP', sans-serif;
|
|
|
|
| 39 |
}
|
| 40 |
-
|
| 41 |
--video-font-family: 'Inter', 'Noto Sans JP', sans-serif !important;
|
| 42 |
-
--
|
| 43 |
-
--
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
--
|
| 47 |
-
--
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
--
|
| 51 |
-
--
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
}
|
| 57 |
media-captions {
|
| 58 |
/* font-family: 'SDK_JP_Web', sans-serif; */
|
| 59 |
font-family: 'Inter', 'Noto Sans JP', sans-serif;
|
| 60 |
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.75), -1px 1px 0 rgba(0, 0, 0, 0.75), 1px -1px 0 rgba(0, 0, 0, 0.75), -1px -1px 0 rgba(0, 0, 0, 0.75);
|
| 61 |
}
|
| 62 |
-
media-player:not([data-can-play]) .media-buffering-indicator,
|
| 63 |
-
media-player[data-waiting] .media-buffering-indicator {
|
| 64 |
-
opacity: 1;
|
| 65 |
-
}
|
| 66 |
footer.copyrightDisp {
|
| 67 |
position: fixed;
|
| 68 |
left: 0;
|
|
@@ -79,37 +83,69 @@
|
|
| 79 |
<div class="wrapper">
|
| 80 |
<media-player
|
| 81 |
title=""
|
| 82 |
-
poster="https://singlecolorimage.com/get/000000/640x360"
|
| 83 |
aspect-ratio="16/9"
|
| 84 |
crossorigin
|
| 85 |
id="player"
|
| 86 |
>
|
| 87 |
-
<media-
|
| 88 |
-
</media-
|
| 89 |
-
<media-
|
|
|
|
| 90 |
</media-player>
|
| 91 |
</div>
|
| 92 |
<script>
|
| 93 |
-
window.addEventListener('load', function(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
document.oncontextmenu = function () {return false;}
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
} else {
|
| 105 |
-
|
| 106 |
-
if (promptedUrl === "") {
|
| 107 |
-
alert("Source not found");
|
| 108 |
-
} else {
|
| 109 |
-
attachSourceToPlayer(promptedUrl);
|
| 110 |
-
}
|
| 111 |
}
|
| 112 |
-
}
|
| 113 |
player.addEventListener('provider-change', (event) => {
|
| 114 |
const provider = event.detail;
|
| 115 |
if (provider?.type === 'hls') {
|
|
@@ -125,13 +161,7 @@
|
|
| 125 |
});
|
| 126 |
});
|
| 127 |
function attachSourceToPlayer (url) {
|
| 128 |
-
|
| 129 |
-
const outletElement = document.querySelector('#player-media-outlet-el');
|
| 130 |
-
const sourceElement = document.createElement("source");
|
| 131 |
-
sourceElement.src = url;
|
| 132 |
-
outletElement.appendChild(sourceElement);
|
| 133 |
-
// Extract and set source title from URL
|
| 134 |
-
// Search "filename.ext" from path string and extract "filename" (exclude ext)
|
| 135 |
player.title = url.match(/^(?:[^:\/?#]+:)?(?:\/\/[^\/?#]*)?(?:([^?#]*\/)([^\/?#]*))?(\?[^#]*)?(?:#.*)?$/)[2].match(/^(.+?)(\.[^.]+)?$/)[1];
|
| 136 |
}
|
| 137 |
function attachSubtitleSourceToPlayer (url) {
|
|
|
|
| 9 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 10 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 11 |
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
|
| 12 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vidstack@^1.0.0/player/styles/default/theme.min.css">
|
| 13 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vidstack@^1.0.0/player/styles/default/layouts/video.min.css">
|
| 14 |
+
<script src="https://cdn.jsdelivr.net/npm/vidstack@^1.0.0/cdn/with-layouts/vidstack.js" type="module"></script>
|
| 15 |
+
<script src='https://unpkg.com/bignumber.js'></script>
|
| 16 |
+
<script src='https://unpkg.com/cbor-web'></script>
|
| 17 |
<style>
|
| 18 |
:root { font-family: 'Inter', sans-serif; }
|
| 19 |
@supports (font-variation-settings: normal) {
|
|
|
|
| 38 |
height: 100%;
|
| 39 |
width: 100%;
|
| 40 |
font-family: 'Inter', 'Noto Sans JP', sans-serif;
|
| 41 |
+
overflow: hidden;
|
| 42 |
}
|
| 43 |
+
.vds-video-layout {
|
| 44 |
--video-font-family: 'Inter', 'Noto Sans JP', sans-serif !important;
|
| 45 |
+
--video-border-radius: 0px !important;
|
| 46 |
+
--video-border: 0px !important;
|
| 47 |
+
}
|
| 48 |
+
:where([data-media-provider], video, media-poster) {
|
| 49 |
+
border-radius: var(--video-border-radius);
|
| 50 |
+
border: var(--video-border);
|
| 51 |
+
}
|
| 52 |
+
:where([data-media-player][data-view-type=video]:not([data-fullscreen])) {
|
| 53 |
+
border-radius: var(--video-border-radius);
|
| 54 |
+
border: var(--video-border);
|
| 55 |
+
}
|
| 56 |
+
:where([data-media-player][data-view-type=video]) {
|
| 57 |
+
border-radius: var(--video-border-radius);
|
| 58 |
+
border: var(--video-border);
|
| 59 |
+
}
|
| 60 |
+
[data-media-provider] video {
|
| 61 |
+
width: 100%;
|
| 62 |
+
height: 100%;
|
| 63 |
+
object-fit: contain;
|
| 64 |
}
|
| 65 |
media-captions {
|
| 66 |
/* font-family: 'SDK_JP_Web', sans-serif; */
|
| 67 |
font-family: 'Inter', 'Noto Sans JP', sans-serif;
|
| 68 |
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.75), -1px 1px 0 rgba(0, 0, 0, 0.75), 1px -1px 0 rgba(0, 0, 0, 0.75), -1px -1px 0 rgba(0, 0, 0, 0.75);
|
| 69 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
footer.copyrightDisp {
|
| 71 |
position: fixed;
|
| 72 |
left: 0;
|
|
|
|
| 83 |
<div class="wrapper">
|
| 84 |
<media-player
|
| 85 |
title=""
|
|
|
|
| 86 |
aspect-ratio="16/9"
|
| 87 |
crossorigin
|
| 88 |
id="player"
|
| 89 |
>
|
| 90 |
+
<media-provider id="player-media-outlet-el">
|
| 91 |
+
</media-provider>
|
| 92 |
+
<media-audio-layout></media-audio-layout>
|
| 93 |
+
<media-video-layout></media-video-layout>
|
| 94 |
</media-player>
|
| 95 |
</div>
|
| 96 |
<script>
|
| 97 |
+
window.addEventListener('load', async function(){
|
| 98 |
+
// const cbor = require('cbor-web');
|
| 99 |
+
window.uiTranslation = {
|
| 100 |
+
"ja-JP": {
|
| 101 |
+
"Audio": "音声",
|
| 102 |
+
"Auto": "自動",
|
| 103 |
+
"Captions": "字幕",
|
| 104 |
+
"Chapters": "チャプター",
|
| 105 |
+
"Default": "既定",
|
| 106 |
+
"Mute": "ミュート",
|
| 107 |
+
"Normal": "標準",
|
| 108 |
+
"Off": "オフ",
|
| 109 |
+
"Pause": "一時停止",
|
| 110 |
+
"Play": "再生",
|
| 111 |
+
"Speed": "速度",
|
| 112 |
+
"Quality": "画質",
|
| 113 |
+
"Settings": "設定",
|
| 114 |
+
"Unmute": "ミュート解除",
|
| 115 |
+
"Seek Forward": "進む",
|
| 116 |
+
"Seek Backward": "戻る",
|
| 117 |
+
"Closed-Captions On": "字幕オン",
|
| 118 |
+
"Closed-Captions Off": "字幕オフ",
|
| 119 |
+
"Enter Fullscreen": "全画面表示",
|
| 120 |
+
"Exit Fullscreen": "全画��表示を終了",
|
| 121 |
+
"Enter PiP": "PiP",
|
| 122 |
+
"Exit PiP": "PiPを終了"
|
| 123 |
+
}
|
| 124 |
+
};
|
| 125 |
+
// uiTranslation.cbor.ja = atob(uiTranslation.base64.ja);
|
| 126 |
+
// uiTranslation.json.ja = await cbor.decodeFirst(uiTranslation.cbor.ja);
|
| 127 |
document.oncontextmenu = function () {return false;}
|
| 128 |
+
window.player = document.querySelector('media-player');
|
| 129 |
+
for (let i = 0; i < Object.keys(uiTranslation).length; i++) {
|
| 130 |
+
if (window.navigator.language == Object.keys(uiTranslation)[i]) {
|
| 131 |
+
document.querySelector('media-video-layout').translations = uiTranslation[Object.keys(uiTranslation)[i]];
|
| 132 |
+
}
|
| 133 |
+
}
|
| 134 |
+
const pageUrlLocationHref = new URL(location.href);
|
| 135 |
+
const pageSearchParams = pageUrlLocationHref.searchParams;
|
| 136 |
+
if (pageSearchParams.has("url") === true && pageSearchParams.get("url") !== "") {
|
| 137 |
+
attachSourceToPlayer(pageSearchParams.get("url"));
|
| 138 |
+
if (pageSearchParams.has("subtitle") === true && pageSearchParams.get("subtitle") !== "") {
|
| 139 |
+
attachSubtitleSourceToPlayer(pageSearchParams.get("subtitle"));
|
| 140 |
+
}
|
| 141 |
+
} else {
|
| 142 |
+
const promptedUrl = prompt("Please input source URL");
|
| 143 |
+
if (promptedUrl === "") {
|
| 144 |
+
alert("Source not found");
|
| 145 |
} else {
|
| 146 |
+
attachSourceToPlayer(promptedUrl);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
}
|
| 148 |
+
}
|
| 149 |
player.addEventListener('provider-change', (event) => {
|
| 150 |
const provider = event.detail;
|
| 151 |
if (provider?.type === 'hls') {
|
|
|
|
| 161 |
});
|
| 162 |
});
|
| 163 |
function attachSourceToPlayer (url) {
|
| 164 |
+
player.src = url;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
player.title = url.match(/^(?:[^:\/?#]+:)?(?:\/\/[^\/?#]*)?(?:([^?#]*\/)([^\/?#]*))?(\?[^#]*)?(?:#.*)?$/)[2].match(/^(.+?)(\.[^.]+)?$/)[1];
|
| 166 |
}
|
| 167 |
function attachSubtitleSourceToPlayer (url) {
|