friendica-github/view/templates/hls_top.tpl
2024-09-14 18:06:59 +00:00

24 lines
No EOL
824 B
Smarty

{{*
* Copyright (C) 2010-2024, the Friendica project
* SPDX-FileCopyrightText: 2010-2024 the Friendica project
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*}}
<div class="video-top-wrapper lframe" id="video-top-wrapper-{{$video.id}}">
<script src="view/js/hls/hls.min.js"></script>
<video id="{{$video.id}}" controls poster="{{$video.preview}}" width="{{$video.width}}" height="{{$video.height}}"
title="{{$video.description}}">
<a href="{{$video.src}}">{{$video.name}}</a>
</video>
<script>
var video = document.getElementById('{{$video.id}}');
var videoSrc = '{{$video.src}}';
if (Hls.isSupported()) {
var hls = new Hls();
hls.loadSource(videoSrc);
hls.attachMedia(video);
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = videoSrc;
}
</script>
</div>