You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

368 lines
14 KiB

4 years ago
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
4 years ago
<title>ACG.WATCH Player</title>
4 years ago
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/awsm.css@3.0.4/dist/awsm_theme_pearl-lusta.min.css">
4 years ago
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/dplayer@1.25.0/dist/DPlayer.min.css">
4 years ago
<script type="text/javascript">block_aplayer = true;lang = ['zh', 'en'];</script>
4 years ago
<script src="https://cdn.yimian.xyz/ushio-js/ushio-head.min.js"></script>
4 years ago
<script type="text/javascript">page.proj = 'iotcat/player';</script>
4 years ago
</head>
<body>
4 years ago
<header>
<h1>ACG.WATCH</h1>
3 years ago
<p><span class=".zh"><abbr title="在 ACG.WATCH">可调教</abbr>的在线视频播放器</span><span class=".en">Watch ACG video <abbr title="At ACG.WATCH">ONLINE</abbr></span></p>
4 years ago
<nav>
<ul>
3 years ago
<li><a href="../" aria-hidden="false"><span class=".zh">主页</span><span class=".en">Homepage</span></a></li>
3 years ago
<li><a href="../list.html"><span class=".zh">列表</span><span class=".en">Playlist</span></a></li>
4 years ago
<li><a href="https://iotcat.me/"><span class=".zh">关于我</span><span class=".en">About Me</span></a></li>
4 years ago
</ul>
</nav>
</header>
<main>
<article>
<section>
<div id="dplayer"></div>
<aside>
<p>
<strong>D.L.</strong>
4 years ago
<a href="javascript:window.open(page.params.url);"><span class=".zh">点击这里下载此视频~</span><span class=".en">You can download this video from here..</span></a>
4 years ago
</p>
</aside>
</section>
<section>
4 years ago
<p><span class=".zh">视频名称</span><span class=".en">Name</span></a>: <span id="video_name"><span class=".zh">未知</span><span class=".en">Unkonwn..</span></span></p>
4 years ago
</section>
<section>
4 years ago
<button onClick="next_video()"><span class=".zh">下一集</span><span class=".en">Next</span></button>
<button onClick="window.location.href='../'"><span class=".zh">主页</span><span class=".en">Homepage</span></button>
4 years ago
</section>
<section>
<details>
4 years ago
<summary><span class=".zh">展开视频参数</span><span class=".en">Show Video Params</span></summary>
<p><span class=".zh">以下是实时视频参数哦^_^</span><span class=".en">Instant video params ^_^</span></p>
4 years ago
<table>
<thead>
<tr>
4 years ago
<th><span class=".zh">名称</span><span class=".en">Params</span></th>
<th><span class=".zh"></span><span class=".en">Value</span></th>
4 years ago
</tr>
</thead>
<tbody>
<tr>
<td>Video_Vid</td>
<td id="video_vid"></td>
</tr>
<tr>
<td>Video_Class</td>
<td id="video_class"></td>
</tr>
<tr>
<td>Video_Series</td>
<td id="video_series"></td>
</tr>
<tr>
<td>Video_No</td>
<td id="video_no"></td>
</tr>
<tr>
<td>Video_Name</td>
4 years ago
<td id="video_name2"></td>
4 years ago
</tr>
<tr>
<td>Video_Link</td>
<td id="video_link"></td>
</tr>
<tr>
<td>Video_description</td>
<td id="video_description"></td>
</tr>
<tr>
<td>Video_DanmakuId</td>
<td id="video_danmaku"></td>
</tr>
<tr>
<td>Video_QualityOptions</td>
<td id="video_quality"></td>
</tr>
<tr>
<td>Video_PlayFrom</td>
<td id="video_playFrom"></td>
</tr>
4 years ago
<tr>
<td>Player_Width</td>
<td id="player_width"></td>
</tr>
<tr>
<td>Player_Height</td>
<td id="player_height"></td>
</tr>
<tr>
<td>Player_CurrentTime</td>
<td id="player_currentTime"></td>
</tr>
<tr>
<td>Player_Duration</td>
<td id="player_duration"></td>
</tr>
<tr>
<td>Player_Volume</td>
<td id="player_volume"></td>
</tr>
<tr>
<td>Player_Paused</td>
<td id="player_paused"></td>
</tr>
<tr>
<td>Danmaku_Num</td>
<td id="danmaku_danIndex"></td>
</tr>
<tr>
<td>Danmaku_Opacity</td>
<td id="danmaku_opacity"></td>
</tr>
<tr>
<td>Danmaku_NumBottom</td>
<td id="danmaku_numBottom"></td>
</tr>
<tr>
<td>Danmaku_NumRight</td>
<td id="danmaku_numRight"></td>
</tr>
<tr>
<td>Danmaku_NumTop</td>
<td id="danmaku_numTop"></td>
</tr>
4 years ago
</tbody>
</table>
</details>
</section>
</article>
</main>
<footer>
2 years ago
<p style="text-align: center;"> Powered By <a href="https://ushio.yimian.xyz">Ushio</a> | Made with love by <a href="https://iotcat.me">iotcat</a> </p>
4 years ago
<br>
</footer>
4 years ago
<script src="https://cdn.yimian.xyz/ushio-js/ushio-footer.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<script src="https://cdn.jsdelivr.net/npm/flv.js@1.5.0/dist/flv.min.js"></script>
<script src="https://cdn.dashjs.org/latest/dash.all.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/webtorrent@latest/webtorrent.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dplayer@1.25.0/dist/DPlayer.min.js"></script>
<script type="text/javascript">
4 years ago
$(function(){
4 years ago
var options = {
container: document.getElementById('dplayer'),
theme: '#'+('00000'+ (Math.random()*0x1000000<<0).toString(16)).substr(-6),
logo: 'https://cdn.yimian.xyz/img/logo/logo_white.png',
4 years ago
lang: ((page.tran.getLang() == 'zh')?'zh-cn':'en'),
4 years ago
autoplay: true,
video: {
4 years ago
pic: 'https://api.yimian.xyz/img/?size=1920x1080',
quality: [],
4 years ago
defaultQuality: 0,
playFrom: 0
4 years ago
},
danmaku: {
id: $.md5(page.params.url+'').substr(0, 8),
api: 'https://api.yimian.xyz/danmaku/',
4 years ago
maximum: 1000,
addition: [],
user: 'iotcat',
bottom: '15%',
unlimited: true,
}
};
/* if no GET video url */
4 years ago
session.onload(()=>{
4 years ago
if(Object.keys(page.params).length === 0 || !page.params.hasOwnProperty("url")){
4 years ago
if(!session.get('acg/last_watch')){
3 years ago
page.params.url = "https://cdn.yimian.xyz/video/404.mp4";
4 years ago
}else{
4 years ago
page.params.url = session.get('acg/last_watch');
history.pushState({},page.title,"https://acg.watch/player?url="+session.get('acg/last_watch'));
4 years ago
}
4 years ago
}else{
4 years ago
session.set('acg/last_watch', page.params.url);
4 years ago
}
4 years ago
});
4 years ago
var dp = {};
4 years ago
var isWaiting = false;
4 years ago
$.get("https://acg.watch/api/getVideoByUrl?url="+page.params.url, function(res){
4 years ago
//res = JSON.parse(res);
4 years ago
options.video.quality = getQuality(res);
4 years ago
options.danmaku.id = res.danmakuID;
options.danmaku.addition = (res.hasOwnProperty('danmakuAdd'))?res.danmakuAdd:[];
4 years ago
dp = new DPlayer(options);
4 years ago
/* recover history playing */
3 years ago
if(options.video.quality[0].url && options.video.quality[0].url != 'https://cdn.yimian.xyz/video/404.mp4'){
4 years ago
session.onload(()=>{
if(session.get($.md5(options.video.quality[0].url)) != null){
dp.seek(session.get($.md5(options.video.quality[0].url)));
options.video.playFrom = session.get($.md5(options.video.quality[0].url));
4 years ago
if(page.tran.getLang() == 'zh')
dp.notice("已恢复到上次播放位置", 4000);
else
dp.notice("Video recovered from Cloud..", 4000);
4 years ago
}
4 years ago
});
4 years ago
}
4 years ago
/* record seek point */
setInterval(function(){
if(!dp.video.paused && dp.video.currentTime > 10){
4 years ago
session.onload(()=>{
session.set($.md5(options.video.quality[0].url), dp.video.currentTime);
});
}
}, 8000);
4 years ago
/* print info */
4 years ago
getInfo(res);
4 years ago
/* next video */
4 years ago
dp.on('ended', next_video);
4 years ago
/* if waiting change source */
4 years ago
dp.on('waiting', waitEvent);
4 years ago
dp.on('playing', function(){
isWaiting = false;
});
4 years ago
});
next_video = function() {
4 years ago
session.onload(()=>{
session.set($.md5(options.video.quality[0].url), "0");
$.get("https://acg.watch/api/getNextByUrl?url="+options.video.quality[1].url, function(res){
4 years ago
//res = JSON.parse(res);
4 years ago
if(page.tran.getLang() == 'zh')
dp.notice("正在跳转至下一集", 4000);
else
dp.notice("Jumping to the next episode", 4000);
4 years ago
setTimeout(function(){
4 years ago
session.set('acg/last_watch', res.url);
4 years ago
history.pushState({},page.title,"https://acg.watch/player?url="+res.url);
page.params.url = res.url;
4 years ago
//res2 = JSON.parse(res2);
4 years ago
options.video.quality = getQuality(res);
4 years ago
options.danmaku.id = res.danmakuID;
options.danmaku.addition = (res.hasOwnProperty('danmakuAdd'))?res.danmakuAdd:[];
4 years ago
options.video.defaultQuality = 0;
4 years ago
options.video.playFrom = 0;
4 years ago
dp.switchVideo(
{
url: res.url,
4 years ago
quality: getQuality(res),
4 years ago
defaultQuality: 0
},
{
4 years ago
id: res.danmakuID,
api: 'https://api.yimian.xyz/danmaku/',
4 years ago
maximum: 1000,
addition: (res.hasOwnProperty('danmakuAdd'))?res.danmakuAdd:[],
4 years ago
user: 'iotcat',
bottom: '15%',
unlimited: true,
}
);
4 years ago
/* print info */
4 years ago
getInfo(res);
4 years ago
//setTimeout(function(){dp.switchQuality(0);}, 1000);
4 years ago
4 years ago
}, 2000);
});
4 years ago
});
4 years ago
}
4 years ago
var getQuality = function(res){
var quality = [
{
name: ((page.tran.getLang() == 'zh')?"自动":'Auto'),
url: 'https://api.yimian.xyz/video/?url='+res.url
},
{
name: ((page.tran.getLang() == 'zh')?"直链":'Origin'),
4 years ago
url: res.url
},
{
name: ((page.tran.getLang() == 'zh')?"代理":'Proxy'),
url: 'https://proxy.yimian.xyz/get/?url='+btoa(res.url)
4 years ago
}
];
if(res.hasOwnProperty('extra') && res.extra.length > 0){
for(var i = 0; i < res.extra.length; i++){
quality.push({
name: ((page.tran.getLang() == 'zh')?"备选"+i+'_直链':'Backup '+i+'_origin'),
4 years ago
url: res.extra[i]
});
quality.push({
name: ((page.tran.getLang() == 'zh')?"备选"+i+'_代理':'Backup '+i+'_proxy'),
url: 'https://proxy.yimian.xyz/get/?url='+btoa(res.extra[i])
});
4 years ago
}
}
return quality;
}
4 years ago
var getInfo = function(res){
printInfo(res);
4 years ago
}
var printInfo = function(res){
$('#video_name').html(res.name);
4 years ago
$('#video_name2').html(res.name);
4 years ago
$('#video_class').html(res.class);
4 years ago
$('#video_series').html(res.seriesID);
4 years ago
$('#video_no').html(res.no);
$('#video_vid').html(res.vid);
4 years ago
$('#video_link').html(res.url);
4 years ago
$('#video_description').html(res.description);
$('#video_quality').html(options.video.quality.length);
$('#video_playFrom').html(options.video.playFrom);
4 years ago
}
4 years ago
var autoSwitchQuality = function(){
if(isWaiting && options.video.quality.length > 1){
4 years ago
waitEvent(15000);
4 years ago
if(options.video.defaultQuality >= options.video.quality.length - 1){
return;
}
4 years ago
if(page.tran.getLang() == 'zh')
dp.notice("监测到卡顿,切换片源");
else
dp.notice("Detected freeze, trying another source");
4 years ago
options.video.defaultQuality = (options.video.defaultQuality >= options.video.quality.length - 1) ? options.video.defaultQuality : options.video.defaultQuality+1;
4 years ago
console.log('Switch quality to ' + options.video.defaultQuality);
4 years ago
dp.switchQuality(options.video.defaultQuality);
}
}
4 years ago
var waitEvent = function(t = 6000){
4 years ago
isWaiting = true;
4 years ago
if(page.timezone == "Asia/Shanghai") autoSwitchQuality();
4 years ago
setTimeout(function(){
if(dp.video.currentTime > options.video.playFrom + 10){
autoSwitchQuality();
}else{
setTimeout(autoSwitchQuality, 9000);
}
4 years ago
}, t);
4 years ago
};
4 years ago
/* print player and danmaku info */
setInterval(function(){
$('#danmaku_numRight').html(Object.keys(dp.danmaku.danTunnel.right).length);
$('#danmaku_numBottom').html(Object.keys(dp.danmaku.danTunnel.bottom).length);
$('#danmaku_numTop').html(Object.keys(dp.danmaku.danTunnel.top).length);
$('#danmaku_opacity').html(dp.danmaku._opacity);
4 years ago
$('#danmaku_danIndex').html(dp.danmaku.danIndex);
$('#video_danmaku').html(options.danmaku.id);
4 years ago
$('#player_width').html(dp.video.videoWidth);
$('#player_height').html(dp.video.videoHeight);
$('#player_volume').html(dp.video.volume);
4 years ago
$('#player_paused').html((dp.video.paused)?"true":"false");
4 years ago
$('#player_currentTime').html(dp.video.currentTime);
$('#player_duration').html(dp.video.duration);
}, 1000);
4 years ago
});
4 years ago
</script>
</body>
</html>