-
Available API
- addTextTrack(kind [, label [, language]]);
-
Additional API
- removeTrack(track);
-
proposals
- addRemoteTrack(options);
-
options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var video = document.querySelector('video'); | |
var caption = video.querySelector('track[kind=captions]'); | |
var captionsArea = document.querySelector('.captions-area'); | |
var captionsDisplay = document.querySelector('.captions-display'); | |
var xhr = new XMLHttpRequest(); | |
xhr.open('GET', caption.src); | |
xhr.onreadystatechange = function() { | |
if (xhr.readyState === 4) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vjs.EventEmitter = function() { | |
}; | |
vjs.EventEmitter.prototype.allowedEvents_ = { | |
}; | |
vjs.EventEmitter.prototype.on = function(type, fn) { | |
vjs.on(this, type, fn); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var vjs = require('video.js'); | |
var doc = require('global/document'); | |
var video = doc.createElement('video'); | |
video.src = 'http://vjs.zencdn.net/v/oceans.mp4'; | |
var link = doc.createElment('link'); | |
link.href = 'http://vjs.zencdn.net/4.11/video-js.css'; | |
link.rel = 'stylesheet'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bar(x) { | |
"use strict"; | |
switch (x) { | |
case 1: | |
let foo = 5; | |
console.log(foo); | |
case 2: | |
foo = 6; | |
return console.log(foo); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
computedStyle = function(el, prop) { | |
if (typeof getComputedStyle === 'function') { | |
return getComputedStyle(el)[prop]; | |
} else { | |
return el.currentStyle[prop]; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Steps to reproduce the problem: | |
1. create a page with a video element | |
2. include a subtitle or caption track | |
3. make sure that the track from above is not marked as `default` | |
What is the expected behavior? | |
the subtitles or captions should show up only if they are marked as default, or if the user selects them. | |
What is the actual behavior? | |
If the user has not previously selected any captions, the first caption in the caption list shows up, regardless or whether that track is in the user locale's or whether the default audio is in the user's locale or not. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// require() some stuff from npm (like you were using browserify) | |
// and then hit Run Code to run it on the right | |
var table = require('html-table-stream'); | |
var concat = require('concat-stream'); | |
var xhr = require('xhr'); | |
xhr('http://crossorigin.me/http://www.transithistory.org/roster/', function(err, res, body) { | |
if (err) { | |
return document.body.innerHTML = err.message; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var async = require('async'); | |
var swap = function(f) { | |
return function(callback) { | |
f(function(e, a) { | |
callback(a, e); | |
}) | |
}; | |
}; | |
module.exports = function tryAll(tasks, callback) { |
Plugins mostly have not changed from how they worked in Videojs 4.x. You still register and use them the same way. The only major change is that if you are instantiating a plugin inside the config of a player, this plugin will get run before the player is ready. This is so that if plugins are doing some UI work or adding themselves as children of the player they can do so early on. This means that plugins that require the player to be ready would need to handle that themselves or else not support instantiation via the player config. Ex:
videojs('my-video', {
plugins: {