如何将上下文菜单嵌入HTML5视频播放器? [英] How do I embed a context menu into an HTML5 video player?

查看:141
本文介绍了如何将上下文菜单嵌入HTML5视频播放器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在摆弄一个HTML5视频播放器 video.js ,我想补充一下这个上下文菜单 ContextJS 。我是新手,我得到的答案越多,我将非常感激。

I am currently fiddling with an HTML5 video player video.js, which I'd like to add this contextual menu ContextJS to. I am new to this and the more answers I get, I will greatly appreciate.

提前谢谢。

推荐答案

通过简要地查看ContextJS文档,您要做的第一件事就是初始化它。

From briefly looking at the ContextJS docs, the first thing you'll want to do is initialize it.

// these are all the defaults
context.init({
    fadeSpeed: 100,
    filter: null,
    above: 'auto',
    preventDoubleContext: true,
    compress: false
});

现在,您可以使用 context.attach启用不同项目的上下文菜单(selector,menuObjects )。

似乎 video.js 适用于该类 video-js 到它制作的所有视频播放器容器。因此,您可以通过以下操作为屏幕上的每个视频添加上下文菜单:

It appears that video.js applies the class video-js to all the video player containers it makes. So you can add a context menu to every video on the screen by doing:

context.attach('.video-js', [
    {text: 'play', action: function(){ /* code */ }},
    {text: 'help', href: '/help.html'}
]);

这篇关于如何将上下文菜单嵌入HTML5视频播放器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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