在 MediaElement.js 中的视频末尾停止而不是倒带
我想知道如何在视频结束时停止 MediaElement.js 播放器。我想知道如何在视频结束时停止 mediaelement.js 播放器。我希望保留最后一帧,而不是像现在一样倒带显示第一帧。
是否可以改变这种行为?
I'm wondering how to stop the MediaElement.js player at the end of the video. I wondered how to stop the mediaelement.js player at the end of a video. I was hoping to hold on the last frame and not rewind to show the first frame as it does now.
Is it possible to change this behaviour?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我为这个问题编写了一个修复程序,John 合并到了 2.10.2 版本中。
现在有一个选项“autoRewind”,您可以将其设置为 false 以防止播放器返回到开头。
事件监听器不会被添加,也不再需要删除它。
I wrote a fix for this problem and John merged in version 2.10.2.
There is now an option "autoRewind" that you can set to false to prevent the player from going back to the beginning.
The eventlistener is not added and there is no more need to remove it.
我相信
元素的默认行为是返回到开头,因此您只需要通过侦听结束事件来覆盖它。
希望有帮助!
I believe that the default behavior of the
<video>
element is to go back to the beginning so you'd just need to override this by listening for the ended event.Hope that helps!
也许最好的解决方案是不要害怕并从 mediaelement 源中删除“倒回到开始视频结束”处理程序。
如果您进入 mediaelement 的源代码并搜索“end”,您最终会发现,到达视频结尾后的倒带实际上是 mediaelement 故意完成的。
如果您想删除该功能,请随意从 mediaelement 源中删除“结束”事件的处理程序。这解决了这个问题的其他答案中提到的所有问题,包括最后一帧和第一帧之间的闪烁。
Probably the best solution is not to be afraid and remove the "rewind-to-start-on-video-end" handler from mediaelement source.
If you go into the source code for mediaelement and search for "ended", you'll eventually see, that rewinding after reaching end of the video is actually done deliberately by mediaelement.
If you want to remove that functionality feel free to just remove that handler for "ended" event from mediaelement source. That solves all the problems, including flickering between last and first frame, mentioned in some other answers to this question.
由于某种原因, John Dyer 的回答中的代码对我来说也不起作用。然而,我能够让这个版本工作......
我遇到的唯一问题 - 这是非常令人沮丧的,是它在 Chrome 中的最后一个帧和第一个帧之间闪烁。否则,它在 Firefox 和 IE 中按预期工作......
The code in John Dyer's answer didn't really work for me either for some reason. I was however able to get this version working...
The only problem I'm having - which is very frustrating, is it is flickering between the LAST and FIRST frames in Chrome. Otherwise, it works as expected in Firefox and IE...
我在播放音频文件时遇到这个问题
问题出在播放中,当您暂停播放器时,文件将停止,但在恢复之前,您必须将播放器的当前时间减少任何值,在您的情况下,您可以将其减少一帧也许
在设置源、加载文件并暂停之后,然后
This problem i faced when playing audio files
The problem is in the play, when you pause your player the file will stop but before resuming you have to decrease the current time of the player by any value in your case you may decrease it by a frame maybe
after setting your source ,loading your file and pausing, then