mediaelement js - 播放完毕后显示海报和播放图标
我希望在视频播放完毕后显示海报和播放图标。
有人尝试实现这一目标吗?
I'd like the poster as well as the play icon to show up when the video has finished playing.
Did anyone try to achieve this yet?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,我自己尝试过一个项目,客户希望在视频完成后返回海报图像。这是我的代码:
mediaelement 播放器以通常的方式实例化。我添加了“成功”函数来监听“结束”事件,然后该事件获取我们的 mediaElement 对象并遍历 DOM 以找到海报图像层并将其重新打开。
Yes, just tried it myself for a project where the client wanted the poster image to come back when the video had completed. Here's my code:
The mediaelement player is instantiated in the usual way. I've added the 'success' function to listen for the "ended" event, which then takes our mediaElement object and traverses the DOM to find the poster image layer and switch it back on.
我只得自己做这件事。
这对我有用。
该视频以幻灯片形式显示,因此如果视频正在播放,我也会暂停幻灯片放映,并在视频结束时重新开始播放。
I just had to do this myself.
This worked for me.
The video is in a slideshow, so i'm also pausing slideshow if video is playing, and starting it again on end of video.