forked from videojs/video.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efe25c0
commit bc47c5e
Showing
5 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Displays the live indicator | ||
* TODO - Future make it click to snap to live | ||
* @param {vjs.Player|Object} player | ||
* @param {Object=} options | ||
* @constructor | ||
*/ | ||
vjs.LiveDisplay = vjs.Component.extend({ | ||
init: function(player, options){ | ||
vjs.Component.call(this, player, options); | ||
|
||
player.on('loadstart', vjs.bind(this, this.updateContent)); | ||
} | ||
}); | ||
|
||
vjs.LiveDisplay.prototype.createEl = function(){ | ||
var el = vjs.Component.prototype.createEl.call(this, 'div', { | ||
className: 'vjs-live-controls vjs-control' | ||
}); | ||
|
||
this.contentEl_ = vjs.createEl('div', { | ||
className: 'vjs-live-display', | ||
innerHTML: '<span class="vjs-control-text">LIVE</span>LIVE', | ||
'aria-live': 'off' | ||
}); | ||
|
||
el.appendChild(this.contentEl_); | ||
|
||
return el; | ||
}; | ||
|
||
vjs.LiveDisplay.prototype.updateContent = function(){ | ||
|
||
// Most Live streams, like RTMP, will report a duration value of -1 | ||
// HLS Live report window.INFINITY | ||
|
||
/* | ||
if (player.duration() < 0 || player.duration() === window.INFINITY) { | ||
this.show(); | ||
} else { | ||
this.hide(); | ||
} | ||
*/ | ||
}; |
This file contains 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