1
0
mirror of https://github.com/videojs/video.js.git synced 2024-11-24 08:42:25 +02:00

added CORS information to tracks guide. Fixes #837

moar magic comments
This commit is contained in:
Matthew McClure 2014-10-17 12:56:36 -07:00 committed by Steve Heffernan
parent 38f1024ad3
commit a70b9e4957
2 changed files with 58 additions and 10 deletions

View File

@ -32,6 +32,11 @@ Once you have your WebVTT file created, you can add it to Video.js using the tra
</video>
```
Subtitles from Another Domain
-----------------------------
Because we're pulling in the text track file via Javascript, the [same-origin policy](http://en.wikipedia.org/wiki/Same_origin_policy) applies. If you'd like to have a player served from one domain,
but the text track served from another, you'll need to [enable CORS](http://enable-cors.org/) in order to do so.
Track Attributes
----------------
Additional settings for track tags.
@ -92,10 +97,10 @@ The two-letter code (valid BCP 47 language tag) for the language of the text tra
<tr><th>fj<th><td>Fiji</td></tr>
<tr><th>fi<th><td>Finnish</td></tr>
</table>
</td>
<td>
<table>
<tr><th>fr<th><td>French</td></tr>
<tr><th>fy<th><td>Frisian</td></tr>
@ -135,10 +140,10 @@ The two-letter code (valid BCP 47 language tag) for the language of the text tra
<tr><th>lo<th><td>Laothian</td></tr>
<tr><th>la<th><td>Latin</td></tr>
</table>
</td>
<td>
<table>
<tr><th>lv<th><td>Latvian (Lettish)</td></tr>
<tr><th>li<th><td>Limburgish ( Limburger)</td></tr>
@ -178,10 +183,10 @@ The two-letter code (valid BCP 47 language tag) for the language of the text tra
<tr><th>ii<th><td>Sichuan Yi</td></tr>
<tr><th>sd<th><td>Sindhi</td></tr>
</table>
</td>
<td>
<table>
<tr><th>si<th><td>Sinhalese</td></tr>
<tr><th>ss<th><td>Siswati</td></tr>
@ -219,7 +224,7 @@ The two-letter code (valid BCP 47 language tag) for the language of the text tra
<tr><th>yo<th><td>Yoruba</td></tr>
<tr><th>zu<th><td>Zulu</td></tr>
</table>
</td>
</tr>
</table>

View File

@ -1226,7 +1226,6 @@ vjs.Player.prototype.sourceList_ = function(sources){
* Begin loading the src data.
* @return {vjs.Player} Returns the player
*/
// http://dev.w3.org/html5/spec/video.html#dom-media-load
vjs.Player.prototype.load = function(){
this.techCall('load');
return this;
@ -1237,7 +1236,6 @@ vjs.Player.prototype.load = function(){
* Can be used in conjuction with `currentType` to assist in rebuilding the current source object.
* @return {String} The current source
*/
// http://dev.w3.org/html5/spec/video.html#dom-media-currentsrc
vjs.Player.prototype.currentSrc = function(){
return this.techGet('currentSrc') || this.cache_.src || '';
};
@ -1252,7 +1250,11 @@ vjs.Player.prototype.currentType = function(){
return this.currentType_ || '';
};
// Attributes/Options
/**
* Get or set the preload attribute.
* @return {String} The preload attribute value when getting
* @return {vjs.Player} Returns the player when setting
*/
vjs.Player.prototype.preload = function(value){
if (value !== undefined) {
this.techCall('setPreload', value);
@ -1261,6 +1263,12 @@ vjs.Player.prototype.preload = function(value){
}
return this.techGet('preload');
};
/**
* Get or set the autoplay attribute.
* @return {String} The autoplay attribute value when getting
* @return {vjs.Player} Returns the player when setting
*/
vjs.Player.prototype.autoplay = function(value){
if (value !== undefined) {
this.techCall('setAutoplay', value);
@ -1269,6 +1277,12 @@ vjs.Player.prototype.autoplay = function(value){
}
return this.techGet('autoplay', value);
};
/**
* Get or set the loop attribute on the video element.
* @return {String} The loop attribute value when getting
* @return {vjs.Player} Returns the player when setting
*/
vjs.Player.prototype.loop = function(value){
if (value !== undefined) {
this.techCall('setLoop', value);
@ -1452,7 +1466,16 @@ vjs.Player.prototype.error = function(err){
return this;
};
/**
* Returns whether or not the player is in the "ended" state.
* @return {Boolean} True if the player is in the ended state, false if not.
*/
vjs.Player.prototype.ended = function(){ return this.techGet('ended'); };
/**
* Returns whether or not the player is in the "seeking" state.
* @return {Boolean} True if the player is in the seeking state, false if not.
*/
vjs.Player.prototype.seeking = function(){ return this.techGet('seeking'); };
// When the player is first initialized, trigger activity so components
@ -1589,6 +1612,12 @@ vjs.Player.prototype.listenForUserActivity = function(){
});
};
/**
* Gets or sets the current playback rate.
* @param {Boolean} rate New playback rate to set.
* @return {Number} Returns the new playback rate when setting
* @return {Number} Returns the current playback rate when getting
*/
vjs.Player.prototype.playbackRate = function(rate) {
if (rate !== undefined) {
this.techCall('setPlaybackRate', rate);
@ -1603,7 +1632,21 @@ vjs.Player.prototype.playbackRate = function(rate) {
};
/**
* Store the current audio state
* @type {Boolean}
* @private
*/
vjs.Player.prototype.isAudio_ = false;
/**
* Gets or sets the audio flag
*
* @param {Boolean} bool True signals that this is an audio player.
* @return {Boolean} Returns true if player is audio, false if not when getting
* @return {vjs.Player} Returns the player if setting
* @private
*/
vjs.Player.prototype.isAudio = function(bool) {
if (bool !== undefined) {
this.isAudio_ = !!bool;