65 lines
1.7 KiB
PHP
65 lines
1.7 KiB
PHP
<?php
|
|
|
|
|
|
/* @var $this \yii\web\View */
|
|
/* @var $id */
|
|
$decode = \app\services\JWT::decode($id, \app\services\JWT::SECRET_KEY);
|
|
$file = \app\models\RegisterObjectFiles::findOne($decode->id);
|
|
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport"
|
|
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<title>Video</title>
|
|
<style>
|
|
body {
|
|
padding: 0;
|
|
margin: 0;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<?= $this->render('/_mobile_view_mode') ?>
|
|
<?php if ($file && $file->streaming_url): ?>
|
|
|
|
<video id="video_play" preload="metadata" webkit-playsinline="webkit-playsinline" autoplay="true" style="width: 100%; height: calc(100% - 50px); position: absolute; top: 50px; left: 0; background: #000000" controls></video>
|
|
<script src="https://cdn.jsdelivr.net/npm/hls.js@1"></script>
|
|
<script>
|
|
|
|
var videoSrc = '<?= $file->streaming_url ?>';
|
|
var video = document.querySelector('#video_play');
|
|
|
|
//
|
|
// First check for native browser HLS support
|
|
//
|
|
if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
|
|
|
//alert('Test 1')
|
|
video.src = videoSrc;
|
|
//
|
|
// If no native HLS support, check if HLS.js is supported
|
|
//
|
|
video.play();
|
|
} else if (Hls.isSupported()) {
|
|
var hls = new Hls();
|
|
hls.loadSource(videoSrc);
|
|
hls.attachMedia(video);
|
|
} else {
|
|
alert('hls is not supported on your browser')
|
|
}
|
|
|
|
video.volume = 0.4
|
|
video.play();
|
|
|
|
</script>
|
|
|
|
<?php endif ?>
|
|
</body>
|
|
</html>
|
|
|