bilibili / flv.js

HTML5 FLV Player
Apache License 2.0
22.91k stars 3.39k forks source link

播放本地FLV长视频跳进时会卡住 #382

Open K7cl opened 5 years ago

K7cl commented 5 years ago

请教两个问题,我有一个几个小时的FLV视频,并非直播,用flv.js时duration如何给出?不填写duration貌似不能跳进跳退。如何可以快速得出精确到毫秒要求的视频时长。另外,我发现大幅度跳进时会卡住,例如一个5个小时的视频我开始播放后直接调到2小时处会一直加载很久也没反应,经测试有时跳几分钟没事,加载一会就开始播放,跳十几分钟以上就会卡住不停地加载,有时候几分钟就卡住。 我的代码如下,其中duration是估计的: if (flvjs.isSupported()) { var videoElement = document.getElementById('videoElement'); var flvPlayer = flvjs.createPlayer({ type: 'flv', url: 'test.flv', duration:17000000, hasAudio:true, hasVideo:true, isLive:false, filesize:5648598423, cors:true }); flvPlayer.attachMediaElement(videoElement); flvPlayer.load(); }

zwjhuhu commented 5 years ago

额,duration这种懒的话,给个整数秒*1000就行了啊

xqq commented 5 years ago

Seek problem is usually caused by lack of keyframes table in onMetaData structure.

If duration field has been existed in the metadata of flv file, it will be not necessary to fill it manually in MediaDataSource again.

K7cl commented 5 years ago

Seek problem is usually caused by lack of keyframes table in onMetaData structure.

If duration field has been existed in the metadata of flv file, it will be not necessary to fill it manually in MediaDataSource again.

flvPlayer.mediaInfo.hasKeyframesIndex false 这说明我需要设置keyframes?请问关于设置keyframes有相关技术文档参考吗?缺少keyframes属于视频本身的问题还是网页代码的? duration恐怕在我的flv文件中没有,如果我不填写duration就会出现类似直播一样的不可移动的进度条。有什么快捷的方法来设置duration吗?

Kyoloro commented 4 years ago

lazyLoad: false

or fill the flv file meta

qqyuanxinqq commented 2 years ago

You can use tool like flvmeta to inject required onMetaData, including both duration and keyframes. https://github.com/noirotm/flvmeta