VideoJS的播放功能

问题描述 投票:0回答:1

我对播放器有问题,关键是当我尝试调用player.play();什么都没发生。 Chrome 72

	var player = videojs('content_video');
	
	player.src({
			src: "https://vdn.terrafox.com/sf/bb-baycam/playlist.m3u8",
			type: "application/x-mpegURL"
	})
	player.ready(() => {
	   player.play()
	})	
	 <link href="http://vjs.zencdn.net/5.19/video-js.css" rel="stylesheet">
	 <script src="http://vjs.zencdn.net/5.19/video.js"></script>
	 <script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-hls/5.8.0/videojs-contrib-hls.min.js" ></script>  
   
    <video id="content_video" class="video-js vjs-default-skin" controls preload="auto" autoplay playsinline width="640" height="360">
    </video>
video.js http-live-streaming
1个回答
0
投票

您正在使用的链接(即https://vdn.terrafox.com/sf/bb-baycam/playlist.m3u8)不存在。因此播放功能不起作用。如果您为ex使用正确的网址。 https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8,它将起作用。

	var player = videojs('content_video');
	
	player.src({
			src: "https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8",
			type: "application/x-mpegURL"
	})
	player.ready(() => {
	   player.play()
	})	
	 <link href="http://vjs.zencdn.net/5.19/video-js.css" rel="stylesheet">
	 <script src="http://vjs.zencdn.net/5.19/video.js"></script>
	 <script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-hls/5.8.0/videojs-contrib-hls.min.js" ></script>  
   
    <video id="content_video" class="video-js vjs-default-skin" controls preload="auto" autoplay playsinline width="640" height="360">
    </video>
© www.soinside.com 2019 - 2024. All rights reserved.