将 Video.js 插件重置为初始状态 [英] Reset Video.js plugin to initial state

查看:130
本文介绍了将 Video.js 插件重置为初始状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 jquery ui 选项卡和 video.js.我想在转到另一个标签时停止视频,并在返回第二个标签时重置它.

I'm using jquery ui tabs and video.js. I want to stop the video when I go to another tab and reset it when I come back to second tab.

推荐答案

从 VideoJS v4.6 开始,您可以执行以下操作来重置播放器:

As of VideoJS v4.6 you can do the following to reset the player:

player.pause().currentTime(0).trigger('loadstart');

那个loadstart是显示海报图片和重新绑定第一个播放事件的关键.

That loadstart is the key which shows the poster image and rebinds the first play event.

这篇关于将 Video.js 插件重置为初始状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆