点播文件技术方案
- 目前支持的点播文件格式有
mp4、hls。 - 支持的编码格式有
H.264、H.265。 - 支持的解码方式有
MediaSource硬解、Webcodec硬解、Wasm软解、Wasm(Simd)软解。
点播MP4
推荐配置
// 推荐配置
const jessibucaPro = new JessibucaPro({
playType: 'playVod',
playVodMp4UseSrc:true,// 使用video的src方式播放mp4
playVodConfig: {
showRateBtn: true, // 显示倍速按钮
rateConfig: [ // 倍速配置
{label: '0.1倍', value: 0.1},
{label: '0.5倍', value: 0.5},
{label: '正常', value: 1},
{label: '2倍', value: 2},
{label: '4倍', value: 4},
{label: '8倍', value: 8},
{label: '12倍', value: 12},
{label: '14倍', value: 14},
{label: '16倍', value: 16},
],
useWCS: true, // 使用Webcodec硬解,依赖HTTPS环境和浏览器支持
useMSE: true, // 使用MediaSource硬解
useSIMD: true // 优先使用使用Wasm(Simd)软解
}
})
// 播放mp4点播文件
jessibucaPro.playVod(url);
或者
const jessibucaPro = new JessibucaPro({
playVodMp4UseSrc:true,// 使用video的src方式播放mp4
})
// 点播,会重置播放器。不推荐
jessibucaPro.playVod(url, {
showRateBtn: true, // 显示倍速按钮
rateConfig: [ // 倍速配置
{label: '0.1倍', value: 0.1},
{label: '0.5倍', value: 0.5},
{label: '正常', value: 1},
{label: '2倍', value: 2},
{label: '4倍', value: 4},
{label: '8倍', value: 8},
{label: '12倍', value: 12},
{label: '14倍', value: 14},
{label: '16倍', value: 16},
],
useWCS: true, // 使用Webcodec硬解,依赖HTTPS环境和浏览器支持
useMSE: true, // 使用MediaSource硬解
useSIMD: true // 优先使用使用Wasm(Simd)软解
})
点播HLS
推荐配置
const jessibucaPro = new JessibucaPro({
playType: 'playVod',
playVodConfig: {
showRateBtn: true, // 显示倍速按钮
rateConfig: [ // 倍速配置
{label: '0.1倍', value: 0.1},
{label: '0.5倍', value: 0.5},
{label: '正常', value: 1},
{label: '2倍', value: 2},
{label: '4倍', value: 4},
{label: '8倍', value: 8},
{label: '12倍', value: 12},
{label: '14倍', value: 14},
{label: '16倍', value: 16},
],
useWCS: true, // 使用Webcodec硬解,依赖HTTPS环境和浏览器支持
useMSE: true, // 使用MediaSource硬解
useSIMD: true // 优先使用使用Wasm(Simd)软解
}
})
jessibucaPro.playVod(url);
或者
const jessibucaPro = new JessibucaPro({
// ...
})
// 点播,会重置播放器。不推荐
jessibucaPro.playVod(url, {
showRateBtn: true, // 显示倍速按钮
rateConfig: [ // 倍速配置
{label: '0.1倍', value: 0.1},
{label: '0.5倍', value: 0.5},
{label: '正常', value: 1},
{label: '2倍', value: 2},
{label: '4倍', value: 4},
{label: '8倍', value: 8},
{label: '12倍', value: 12},
{label: '14倍', value: 14},
{label: '16倍', value: 16},
],
useWCS: true, // 使用Webcodec硬解,依赖HTTPS环境和浏览器支持
useMSE: true, // 使用MediaSource硬解
useSIMD: true // 优先使用使用Wasm(Simd)软解
})
点播FLV
使用
playback机制去播放的
看playback-simple-demo-forward.html示例。
由于flv文件没法做seek操作,不推荐使用flv文件做点播文件。如果要使用flv文件做点播文件,目前播放器可以支持,但需要注意以下几点:
支持的功能
- flv点播文件支持
暂停、播放功能。 - flv点播文件支持
倍速功能(0.1-16倍率)。 - flv点播文件单帧播放功能。
- flv点播文件支持单关键帧播放功能。
不支持的功能
- flv点播文件
不支持seek功能,进度条无法拖动。