Files
register/marko_unpacked/marko/cms/views/media/play.php
T
Admin Nasledstvo ac168868ee Initial import
2026-05-01 20:52:04 +03:00

51 lines
1.3 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);
?>
<style>
body {
padding: 0;
margin: 0;
}
</style>
<?= $this->render('/_mobile_view_mode') ?>
<?php if ($file && $file->streaming_url): ?>
<video id="video_play" style="width: 100%; height: 100%; position: absolute: top: 0; left: 0; background: #000000" controls autoplay></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 ?>