总览
videojs('cameraVideo', {
autoplay: true,// 自动播放
controls: true,// 控件展示
controlBar: {//控件按钮显示设置
playToggle: false,//播放切换按钮
captionsButton: false,
chaptersButton: false,
subtitlesButton: false,
remainingTimeDisplay: false,
progressControl: {
seekBar: true
},
fullscreenToggle: false,
playbackRateMenuButton: false,
},
})
src中type可选值
一、MP4 (H.264)
<source src="movie.mp4" type="video/mp4">
一、WebM (VP8/VP9)
<source src="movie.webm" type="video/webm">
一、Ogg/Theora/Vorbis
<source src="movie.ogv" type="video/ogg; codecs='theora, vorbis'">
一、MPEG-DASH
<source src="manifest.mpd" type="application/dash+xml">
一、HLS (HTTP Live Streaming)
<source src="playlist.m3u8" type="application/x-mpegURL">
或者
<source src="playlist.m3u8" type="application/vnd.apple.mpegurl">
一、RTMP (Real-Time Messaging Protocol) RTMP 不是通过 标签直接设置的,而是通过 Video.js 的插件(如 videojs-flash 或 videojs-contrib-rtmp)间接实现。
一、FLV FLV 文件通常需要 Flash 插件或者特殊的 JavaScript 解析库,并非原生 HTML5 支持的格式,但在 Video.js 中可以通过相应的插件支持播放:
<!-- 需配合Flash插件 -->
<source src="movie.flv" type="video/x-flv">