sherry是什么意思| 辟支佛是什么意思| 为什么女人要带阴环| 头疼 吃什么药| 观音菩萨的坐骑是什么| 尿频尿急小腹胀痛吃什么药| 纳氏囊肿是什么意思| 热休克蛋白90a检查高是什么原因| 身体不出汗是什么原因| 蜕变是什么意思| 韩字五行属什么| 长期喝茶有什么危害| 农历9月11日是什么星座| 皮蛋是什么蛋做的| 35属什么| 4ever是什么意思| asic是什么意思| 原位杂交技术检查什么| 桃子有什么好处| 斯德哥尔摩综合征是什么| 咳嗽吐白痰吃什么药| 小狗拉稀吃什么药| 胃息肉有什么症状| 64属什么| 痰多是什么问题| 两败俱伤是什么意思| 一什么椅子| 支原体衣原体是什么病| 吃什么润肠通便| 1905年是什么朝代| 晒伤擦什么药| 胃不好的人吃什么养胃| 月黑风高什么意思| 耳鼻喉属于什么科| 外阴瘙痒用什么药好| 血小板上升是什么原因| 嘴上长痘痘是什么原因| 阁下是什么意思| 小朋友口臭是什么原因| 守宫是什么意思| 埋汰是什么意思| 肠胃炎适合吃什么食物| 推头是什么意思| 梦见自己生二胎是什么意思| 大料是什么调料| 三点水的字大多与什么有关| pisen是什么牌子| .什么意思| 北京是什么省| 球蛋白的功效与作用是什么| lively是什么意思| 尿蛋白高吃什么药| 手关节黑是什么原因| 对蚊子过敏是什么症状| 3.15是什么星座| 头发不干就睡觉有什么危害| 合肥为什么叫合肥| 肠胃不好吃什么| 发烧能吃什么水果| 什么平什么静| 梦见女尸是什么预兆| 吃什么可以回奶| 身份证照片穿什么颜色衣服| prc是什么| 怎么看微信好友什么时候加的| 弥补是什么意思| 什么皮球| 沛是什么意思| 番薯是什么| 俊俏是什么意思| 十二指肠胃溃疡吃什么药| 血小板少是什么病| 什么是白癜风| 化气行水是什么意思| 用鸡蛋滚脸有什么好处| 小便有点黄是什么原因| 中暑喝什么| 小孩急性肠胃炎吃什么药| syphilis是什么意思| 什么可以驱蛇| 表象是什么意思| 大豆和黄豆有什么区别| 早餐吃什么不升血糖| 什么是鸡尾酒| 西兰花不能和什么一起吃| 脸无缘无故的肿是什么原因| 为什么会感冒| 小孩子记忆力差是什么原因| 心梗是什么原因引起的| 为什么会得结石| 睡觉时胳膊和手发麻是什么原因| 冲正是什么意思| 青春痘用什么药膏擦最好呢| 孤单是什么意思| 花椒是什么| iga什么意思| 尿蛋白尿潜血同时出现说明什么| 4级残疾证有什么优惠政策| 牛肉汤配什么菜好吃| 六堡茶属于什么茶| 右肺上叶结节什么意思| 女人太瘦吃什么增肥| 马蹄什么季节上市| 脚痒用什么药好| 热疹用什么药膏最好| 门特是什么| 儿童腮腺炎挂什么科| 甘油三酯查什么项目| 胸片能查出什么| 反洗钱是什么意思| 表姐的女儿叫什么| 淋巴门结构可见是什么意思| 梦见山体滑坡是什么意思| 慷他人之慨什么意思| 大曲是什么| 火加良念什么| 磁共振是检查什么| 疑虑是什么意思| 甲状腺肿物是什么意思| 嗓子疼可以吃什么水果| 乳糖不耐受喝什么牛奶| 石化是什么意思| 揾什么意思| 智齿什么时候拔最好| 黔驴技穷是什么意思| 昭字五行属什么| cav是什么意思| 中元节应该说什么| gh是什么意思| lime是什么水果| 舌面有裂纹是什么原因| 黄豆酱做什么菜好吃| 温度计里面红色液体是什么| 松果体囊肿是什么病| sku图是什么意思| 姓贾的男孩取什么名字好| 瘢痕体质是什么意思| rapido是什么牌子| 女生吃什么可以丰胸| 长的像蛇的鱼是什么鱼| 产生幻觉是什么原因| 吃什么能改善睡眠| 12月29号是什么星座| becky是什么意思| 天秤座是什么星座| 胎位loa是什么意思| 西红柿和什么不能一起吃| 男人吃什么容易生儿子| 为什么精液是流出来的| 为什么手麻| 黄瓜吃多了有什么坏处| 晚上睡觉多梦是什么原因| 两什么三什么| 哦是什么意思在聊天时| 脑供血不足什么症状| 丝丝入扣是什么意思| 八月十三什么星座| 1979是什么年| 1959年属什么生肖| 观照是什么意思| v8是什么| 头晕目眩挂什么科| 小三阳有什么症状表现| 钙片什么牌子好| 老公是什么意思| 碉堡是什么意思啊| 老鸨什么意思| 肝不好有什么症状有哪些表现| 元老是什么意思| 长期喝枸杞水有什么好处和坏处| 7月初7是什么节日| 颈椎曲度变直有什么症状| 11月2号是什么星座| 下火吃什么药| 性冷淡是什么| 迟缓是什么意思| gap是什么牌子的衣服| 腰椎退变是什么意思| 全血细胞减少是什么意思| 注会什么时候考试| 女人吃黄芪有什么好处| 抑郁症吃什么药最好| 睾丸皮痒用什么药膏| 左侧卵巢囊性回声是什么意思| 办理健康证需要什么| 盆腔炎有什么明显症状| MC是什么牌子的车| 磋磨什么意思| 穴位是什么| 仁义道德是什么意思| 鱼肚是什么| 血型阳性是什么意思| 世界上最高的高原是什么| 7月出生的是什么星座| 为什么支气管炎咳嗽长期不好| 胎盘中药叫什么| 南海龙王叫什么| 办健康证要带什么| 400能上什么大学| cm是什么单位| wy是什么牌子| 胎盘下缘达宫颈内口是什么意思| 上坟可以带什么水果| 太作了是什么意思| 豆粕是什么| gold什么意思| 核素是什么| 舒张压是什么| 看日历是什么生肖| 圣女是什么意思| 小金人车标是什么车| 食管憩室是什么病| 左边太阳穴疼是什么原因| 待客是什么意思| 肝血管瘤是什么原因引起的| mchc偏低是什么意思| 男人结扎有什么好处| vcr是什么| 为什么会打呼| 医院属于什么性质的单位| 梦见摘西红柿是什么意思| 蟹爪兰什么时候开花| 学医需要什么条件| 诟病是什么意思| 妇科彩超主要检查什么| 早上睡不醒是什么原因| 小孩坐火车需要什么证件| 尿特别多是什么原因| 1999年属什么| 为什么会低血压| 速干裤是什么面料| 肚子里有虫子会有什么症状| 大便颗粒状是什么原因| 人为什么会晕车| 捞面条配什么菜好吃| 月子期间能吃什么水果| 肌肉一跳一跳什么原因| 恨天高是什么意思| 头痛吃什么药| 杨桃是什么季节的水果| 鹌鹑蛋是什么动物的蛋| 幽门螺旋杆菌有什么危害| 孙尚香字什么| 我做错了什么| 11.19是什么星座| 非洲有什么动物| perrier是什么水| 肋骨下面是什么部位| fda认证是什么意思| bcm是什么意思| 带蜜蜡有什么好处| 灵五行属性是什么| 什么是猎奇| 什么是溶液| nk是什么意思| cocoon是什么品牌| 什么食物含钾最高| 四月二十九是什么星座| 放疗期间吃什么食物最好| ecg是什么意思| 命里有时终须有命里无时莫强求什么意思| 膝盖疼痛是什么原因| PA医学上是什么意思| 一生无虞是什么意思| 百度

成都新津集中签约57个项目 投资额达1077亿元

Video.js Guides

百度 其三是关于国家监察委员会的设立。

These guides cover a range of topics for users of Video.js

Video.js Plugins

NOTE: This guide is focused on Video.js 8+. It no longer mentions use of the videojs.extend() method, which was removed in 8.0. Please see our migration guide for further information!

One of the great strengths of Video.js is its ecosystem of plugins that allow authors from all over the world to share their video player customizations. This includes everything from the simplest UI tweaks to new playback technologies and source handlers!

Because we view plugins as such an important part of Video.js, the organization is committed to maintaining a robust set of tools for plugin authorship:

  • generator-videojs-plugin

    A Yeoman generator for scaffolding a Video.js plugin project. Additionally, it offers a set of conventions for plugin authorship that, if followed, make authorship, contribution, and usage consistent and predictable.

    In short, the generator sets up plugin authors to focus on writing their plugin - not messing with tools.

Writing a Basic Plugin

If you've written a Video.js plugin before, the basic plugin concept should be familiar. It's similar to a jQuery plugin in that the core idea is that you're adding a method to the player.

Write a JavaScript Function

A basic plugin is a plain JavaScript function:

function examplePlugin(options) {

  if (options.customClass) {
    this.addClass(options.customClass);
  }

  this.on('playing', function() {
    videojs.log('playback began!');
  });
}

By convention, plugins are passed an options object; however, you can realistically accept whatever arguments you want. This example plugin will add a custom class (whatever is passed in as options.customClass) and, whenever playback begins, it will log a message to the browser console.

Note: The value of this in the plugin function is the player instance; so, you have access to its complete API.

Register a Basic Plugin

Now that we have a function that does something with a player, all that's left is to register the plugin with Video.js:

videojs.registerPlugin('examplePlugin', examplePlugin);

After that, any player will automatically have an examplePlugin method on its prototype!

Note: The only stipulation with the name of the plugin is that it cannot conflict with any existing plugin or player method.

Writing an Advanced Plugin

Video.js 6 introduced advanced plugins: these are plugins that share a similar API with basic plugins, but are class-based and offer a range of extra features out of the box.

While reading the following sections, you may want to refer to the Plugin API docs for more detail.

Write a JavaScript Class/Constructor

If you're familiar with creating components, this process is similar. An advanced plugin starts with a JavaScript class:

const Plugin = videojs.getPlugin('plugin');

class ExamplePlugin extends Plugin {

  constructor(player, options) {
    super(player, options);

    if (options.customClass) {
      player.addClass(options.customClass);
    }

    player.on('playing', function() {
      videojs.log('playback began!');
    });
  }
}

For now, this example advanced plugin does the exact same thing as the basic plugin described above - not to worry, we will make it more interesting as we continue!

Register an Advanced Plugin

The registration process for advanced plugins is identical to the process for basic plugins.

videojs.registerPlugin('examplePlugin', ExamplePlugin);

Key Differences from Basic Plugins

Advanced plugins have two key differences from basic plugins that are important to understand before describing their advanced features.

The Value of this

With basic plugins, the value of this in the plugin function will be the player.

With advanced plugins, the value of this is the instance of the plugin class. The player is passed to the plugin constructor as its first argument (and is automatically applied to the plugin instance as the player property) and any further arguments are passed after that.

The Player Plugin Name Property

Both basic plugins and advanced plugins are set up by calling a method on a player with a name matching the plugin (e.g., player.examplePlugin()).

However, with advanced plugins, this method acts like a factory function and it is replaced for the current player by a new function which returns the plugin instance:

// `examplePlugin` has not been called, so it is a factory function.
player.examplePlugin();

// `examplePlugin` is now a function that returns the same instance of
// `ExamplePlugin` that was generated by the previous call.
player.examplePlugin().someMethodName();

With basic plugins, the method does not change - it is always the same function. It is up to the authors of basic plugins to deal with multiple calls to their plugin function.

Features of Advanced Plugins

Up to this point, our example advanced plugin is functionally identical to our example basic plugin. However, advanced plugins bring with them a great deal of benefit that is not built into basic plugins.

Events

Like components, advanced plugins offer an implementation of events. This includes:

  • The ability to listen for events on the plugin instance using on or one:

    player.examplePlugin().on('example-event', function() {
      videojs.log('example plugin received an example-event');
    });
  • The ability to trigger custom events on a plugin instance:

    player.examplePlugin().trigger('example-event');
  • The ability to stop listening to custom events on a plugin instance using off:

    player.examplePlugin().off('example-event');

By offering a built-in events system, advanced plugins offer a wider range of options for code structure with a pattern familiar to most web developers.

Extra Event Data

All events triggered by plugins include an additional data object as a second argument. This object has three properties:

  • name: The name of the plugin (e.g. "examplePlugin") as a string.
  • plugin: The plugin constructor (e.g. ExamplePlugin).
  • instance: The plugin constructor instance.

Statefulness

A new concept introduced for advanced plugins is statefulness. This is similar to React components' state property and setState method.

Advanced plugin instances each have a state property, which is a plain JavaScript object - it can contain any keys and values the plugin author wants.

A default state can be provided by adding a static property to a plugin constructor:

ExamplePlugin.defaultState = {
  customClass: 'default-custom-class'
};

When the state is updated via the setState method, the plugin instance fires a "statechanged" event, but only if something changed! This event can be used as a signal to update the DOM or perform some other action. The event object passed to listeners for this event includes, an object describing the changes that occurred on the state property:

player.examplePlugin().on('statechanged', function(e) {
  if (e.changes && e.changes.customClass) {
    this.player
      .removeClass(e.changes.customClass.from)
      .addClass(e.changes.customClass.to);
  }
});

player.examplePlugin().setState({customClass: 'another-custom-class'});

Lifecycle

Like components, advanced plugins have a lifecycle. They can be created with their factory function and they can be destroyed using their dispose method:

// set up a example plugin instance
player.examplePlugin();

// dispose of it anytime thereafter
player.examplePlugin().dispose();

The dispose method has several effects:

  • Triggers a "dispose" event on the plugin instance.
  • Cleans up all event listeners on the plugin instance, which helps avoid errors caused by events being triggered after an object is cleaned up.
  • Removes plugin state and references to the player to avoid memory leaks.
  • Reverts the player's named property (e.g. player.examplePlugin) back to the original factory function, so the plugin can be set up again.

In addition, if the player is disposed, the disposal of all its advanced plugin instances will be triggered as well.

Version

Adding a version number to a plugin is done by defining a VERSION property on the plugin before registering it:

ExamplePlugin.VERSION = '1.0.1';

videojs.registerPlugin('examplePlugin', ExamplePlugin);

Retrieve it using videojs.getPluginVersion:

var version = videojs.getPluginVersion('examplePlugin');
console.log(version);  // 1.0.1

Note that the plugin generator already takes care of adding a version number for you.

Logging

By default, each advanced plugin instance has its own log property much like videojs and Player instances do. The log messages will be prefixed with the player's ID and the plugin's name:

player.examplePlugin().log('hello world!');

The above will log the following:

VIDEOJS: $PLAYER_ID: examplePlugin: hello world!

The log function will also have all the methods/properties of the default videojs.log; such as, error(), warn(), level(), etc.

NOTE: This method is added in the constructor and it will not override any predefined log property of the plugin's prototype.

Advanced Example Advanced Plugin

What follows is a complete ES6 advanced plugin that logs a custom message when the player's state changes between playing and pause. It uses all the described advanced features:

import videojs from 'video.js';

const Plugin = videojs.getPlugin('plugin');

class Advanced extends Plugin {

  constructor(player, options) {
    super(player, options);

    // Whenever the player emits a playing or pause event, we update the
    // state if necessary.
    this.on(player, ['playing', 'pause'], this.updateState);
    this.on('statechanged', this.logState);
  }

  dispose() {
    super.dispose();
    videojs.log('the advanced plugin is being disposed');
  }

  updateState() {
    this.setState({playing: !this.player.paused()});
  }

  logState(changed) {
    videojs.log(`the player is now ${this.state.playing ? 'playing' : 'paused'}`);
  }
}

videojs.registerPlugin('advanced', Advanced);

const player = videojs('example-player');

player.advanced();

// This will begin playback, which will trigger a "playing" event, which will
// update the state of the plugin, which will cause a message to be logged.
player.play();

// This will pause playback, which will trigger a "paused" event, which will
// update the state of the plugin, which will cause a message to be logged.
player.pause();

player.advanced().dispose();

// This will begin playback, but the plugin has been disposed, so it will not
// log any messages.
player.play();

This example may be a bit pointless in reality, but it demonstrates the sort of flexibility offered by advanced plugins over basic plugins.

Setting up a Plugin

There are two ways to set up (or initialize) a plugin on a player. Both ways work identically for both basic and advanced plugins.

The first way is during creation of the player. Using the plugins option, a plugin can be automatically set up on a player:

videojs('example-player', {
  plugins: {
    examplePlugin: {
      customClass: 'example-class'
    }
  }
});

Otherwise, a plugin can be manually set up:

var player = videojs('example-player');
player.examplePlugin({customClass: 'example-class'});

These two methods are functionally identical - use whichever you prefer!

Plugin Setup Events

Occasionally, a use-case arises where some code needs to wait for a plugin to be initialized. As of Video.js 6, this can be achieved by listening for pluginsetup events on the player.

For any given plugin initialization, there are four events to be aware of:

  • beforepluginsetup: Triggered immediately before any plugin is initialized.
  • beforepluginsetup:examplePlugin Triggered immediately before the examplePlugin is initialized.
  • pluginsetup: Triggered after any plugin is initialized.
  • pluginsetup:examplePlugin: Triggered after the examplePlugin is initialized.

These events work for both basic and advanced plugins. They are triggered on the player and each includes an object of extra event data as a second argument to its listeners.

References

仪态万方是什么意思 肺大泡用什么药 半岛铁盒是什么 吃东西就吐是什么原因 牙疼脸肿了吃什么药
戏是什么生肖 siri什么意思 不约而至是什么意思 便秘吃什么药最好 车间管理人员工资计入什么科目
胃泌素是什么 maxrieny是什么品牌 舌头有问题应该挂什么科 囊是什么结构 990是什么意思
老实的动物是什么生肖 五月十一是什么星座 铁皮石斛花有什么作用 分身是什么意思 女大四岁有什么说法
一个木一个寿念什么hcv9jop4ns3r.cn 富氢水是什么tiangongnft.com flair呈高信号是什么意思hcv8jop9ns9r.cn 自五行属什么bjhyzcsm.com 月经老提前是什么原因hcv7jop7ns3r.cn
鸣字五行属什么hcv8jop0ns0r.cn 翊什么意思hcv9jop1ns6r.cn 抹茶是什么茶hcv9jop6ns4r.cn sheep是什么意思mmeoe.com 孕妇不吃饭对胎儿有什么影响hcv8jop7ns9r.cn
纳呆什么意思hcv9jop6ns3r.cn 15度穿什么衣服hcv9jop7ns3r.cn 岁月静好什么意思hcv7jop9ns2r.cn 木圣念什么hcv8jop4ns3r.cn 抗核抗体阳性是什么意思hcv8jop1ns1r.cn
折耳猫什么颜色最贵hcv9jop4ns4r.cn 谷草谷丙偏高代表什么hcv9jop6ns6r.cn 法西斯战争是什么意思fenrenren.com 部署是什么意思travellingsim.com 解表化湿是什么意思520myf.com
百度