qcloud-iot-mjpeg-player
用于在h5面板中播放 mjpeg 云存视频
dev
npm start # or yarn start
如何使用
import { Player } from 'qcloud-iot-mjpeg-player';
const player = new Player({
videoUrl: 'http://localhost:3000/video.mpg',
audioUrl: 'http://localhost:3000/audio.aac',
container: document.querySelector('.container'),
// 播放时间更新时触发
onTimeUpdate(time, duration) {
progressEl.value = time / duration * 100;
}
onWatting() {
// 在加载中,显示下loading
}
onPlaying() {
// 缓冲完成,不要显示 loading 了
}
});
// 切换source
player.setSource({
videoUrl: 'http://localhost:3000/video.mpg',
audioUrl: 'http://localhost:3000/audio.aac',
})
完整 demo 可见: https://github.com/Tencentlianlian/mjpeg-player-demo