Skip to content

Commit

Permalink
Fire "seeking" from the Flash tech
Browse files Browse the repository at this point in the history
SWF code is still hard to validate so move the logic to fire "seeking" into the js portion of the Flash tech.
  • Loading branch information
dmlap committed Jul 15, 2015
1 parent dfd4810 commit d786673
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions src/js/tech/flash.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @file flash.js
* @file flash.js
* VideoJS-SWF - Custom Flash Player with HTML5-ish API
* https://github.com/zencoder/video-js-swf
* Not using setupTriggers. Using global onEvent func to distribute events
Expand Down Expand Up @@ -54,6 +54,10 @@ class Flash extends Tech {
window.videojs.Flash.onReady = Flash.onReady;
window.videojs.Flash.onEvent = Flash.onEvent;
window.videojs.Flash.onError = Flash.onError;

this.on('seeked', function() {
this.lastSeekTarget_ = undefined;
});
}

/**
Expand Down Expand Up @@ -124,8 +128,8 @@ class Flash extends Tech {
/**
* Get/set video
*
* @param {Object=} src Source object
* @return {Object}
* @param {Object=} src Source object
* @return {Object}
* @method src
*/
src(src) {
Expand All @@ -140,7 +144,7 @@ class Flash extends Tech {
/**
* Set video
*
* @param {Object=} src Source object
* @param {Object=} src Source object
* @deprecated
* @method setSrc
*/
Expand All @@ -157,22 +161,31 @@ class Flash extends Tech {
}
}

/**
* Returns true if the tech is currently seeking.
* @return {boolean} true if seeking
*/
seeking() {
return this.lastSeekTarget_ !== undefined;
}

/**
* Set current time
*
* @param {Number} time Current time of video
* @param {Number} time Current time of video
* @method setCurrentTime
*/
setCurrentTime(time) {
this.lastSeekTarget_ = time;
this.trigger('seeking');
this.el_.vjs_setProperty('currentTime', time);
super.setCurrentTime();
}

/**
* Get current time
*
* @param {Number=} time Current time of video
* @param {Number=} time Current time of video
* @return {Number} Current time
* @method currentTime
*/
Expand Down Expand Up @@ -240,19 +253,19 @@ class Flash extends Tech {
/**
* Get buffered time range
*
* @return {TimeRangeObject}
* @return {TimeRangeObject}
* @method buffered
*/
buffered() {
return createTimeRange(0, this.el_.vjs_getProperty('buffered'));
}

/**
* Get fullscreen support -
* Get fullscreen support -
* Flash does not allow fullscreen through javascript
* so always returns false
*
* @return {Boolean} false
* @return {Boolean} false
* @method supportsFullScreen
*/
supportsFullScreen() {
Expand All @@ -264,7 +277,7 @@ class Flash extends Tech {
* Flash does not allow fullscreen through javascript
* so always returns false
*
* @return {Boolean} false
* @return {Boolean} false
* @method enterFullScreen
*/
enterFullScreen() {
Expand All @@ -277,7 +290,7 @@ class Flash extends Tech {
// Create setters and getters for attributes
const _api = Flash.prototype;
const _readWrite = 'rtmpConnection,rtmpStream,preload,defaultPlaybackRate,playbackRate,autoplay,loop,mediaGroup,controller,controls,volume,muted,defaultMuted'.split(',');
const _readOnly = 'error,networkState,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,ended,videoTracks,audioTracks,videoWidth,videoHeight'.split(',');
const _readOnly = 'error,networkState,readyState,initialTime,duration,startOffsetTime,paused,played,ended,videoTracks,audioTracks,videoWidth,videoHeight'.split(',');

function _createSetter(attr){
var attrUpper = attr.charAt(0).toUpperCase() + attr.slice(1);
Expand Down

0 comments on commit d786673

Please sign in to comment.