mangui/video-js-swf — pull request #3 by Hiroshi-p (2014-08-07 20:35:06+00:00)
Title: Hook up flashls level API as videojs custom SWF API.

This hooks up flashls API to custom video-js.swf layer.
This needs additional change inside video.js itself to let video-js users may access it finally.

This is diff for videojs/video.js repository.
I do not know what is the best way to delivery that part of the change, as videojs's project does not have our custom flash change (yet) and I assume they do not want to take this.

src/js/media/flash.js | 4 ++--
src/js/player.js | 21 +++++++++++++++++++++
2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/js/media/flash.js b/src/js/media/flash.js
index 1291146..1942a08 100644
--- a/src/js/media/flash.js
+++ b/src/js/media/flash.js
@@ -196,8 +196,8 @@ vjs.Flash.prototype.enterFullScreen = function(){
(function(){
// Create setters and getters for attributes
var api = vjs.Flash.prototype,
- readWrite = 'rtmpConnection,rtmpStream,preload,defaultPlaybackRate,playbackRate,autoplay,loop,mediaGroup,controller,controls,volume,muted,defaultMuted'.split(','),
- readOnly = 'error,networkState,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks'.split(','),
+ readWrite = 'rtmpConnection,rtmpStream,preload,defaultPlaybackRate,playbackRate,autoplay,loop,mediaGroup,controller,controls,volume,muted,defaultMuted,level'.split(','),
+ readOnly = 'error,networkState,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks,numberOfLevels,autoLevelEnabled'.split(','),
// Overridden: buffered, currentTime, currentSrc
i;

diff --git a/src/js/player.js b/src/js/player.js
index 781628b..960c74f 100644
--- a/src/js/player.js
+++ b/src/js/player.js
@@ -1649,6 +1649,27 @@ vjs.Player.prototype.playbackRate = function(rate) {

};

+vjs.Player.prototype.numberOfLevels = function () {
+ // getting
+ return parseInt(this.techGet('numberOfLevels'));
+};
+
+vjs.Player.prototype.level = function (value) {
+ // setting
+ if (value !== undefined) {
+ this.techCall('setLevel', value);
+ return this;
+ }
+
+ // getting
+ return parseInt(this.techGet('level'));
+};
+
+vjs.Player.prototype.autoLevelEnabled = function () {
+ // getting
+ return (this.techGet('autoLevelEnabled') === false) ? false : true;
+};
+
// Methods to add support for
// networkState: function(){ return this.techCall('networkState'); },
// readyState: function(){ return this.techCall('readyState'); },