[英]Is there any way to record an hls live stream video in safari webview (ionic)?
[英]Video-js tag autoplay HLS Live stream
我正在通過 videojs 直播。 流有效,但我無法讓它自動播放。 相反,我每次進入頁面時都需要單擊播放按鈕。
<video-js id="my_video" autoplay controls preload="auto" width="762" height="428" poster="images/poster2.jpg">
<source src="http://xx.xxx.xxx.xx:1935/live/xxxxx/playlist.m3u8" type="application/x-mpegURL">
</video-js>
<script src="https://unpkg.com/video.js/dist/video.js"></script>
<script src="https://unpkg.com/@videojs/http-streaming/dist/videojs-http-streaming.js"></script>
<script>
var player = videojs('my_video');
video.autoplay = true
</script>
許多瀏覽器現在不允許自動播放,除非視頻被靜音。 您可以添加muted
屬性。
您還可以使用any
選項進行自動播放,在這種情況下,如果可能,視頻將自動播放聲音,如果沒有,則自動播放靜音(如果可能)。 刪除autoplay
屬性並改用設置選項:
var player = videojs('my_video', {autoplay: 'any'});
var options, player;
options = {
controls: true,
autoplay:'any',
techOrder: [ 'chromecast', 'html5' ],
plugins: {
chromecast: {}
}
};
player = videojs(document.getElementById('vjs'), options, function() {
player.chromecast();
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.