Skip to content

Commit

Permalink
Updated flash tech to support new errors
Browse files Browse the repository at this point in the history
  • Loading branch information
heff committed May 7, 2014
1 parent 56cbe66 commit 11ca9cd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 19 deletions.
11 changes: 9 additions & 2 deletions src/js/media/flash.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,15 @@ vjs.Flash['onEvent'] = function(swfID, eventName){
// Log errors from the swf
vjs.Flash['onError'] = function(swfID, err){
var player = vjs.el(swfID)['player'];
player.trigger('error');
vjs.log('Flash Error', err, swfID);
var msg = 'FLASH: '+err;

if (err == 'srcnotfound') {
player.error({ code: 4, message: msg });

// errors we haven't categorized into the media errors
} else {
player.error(msg);
}
};

// Flash Version Check
Expand Down
35 changes: 18 additions & 17 deletions src/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1345,31 +1345,32 @@ vjs.Player.prototype.error = function(err){
this.addClass('vjs-error');

// log the name of the error type and any message
vjs.log.error(this.error_);
// ie8 just logs "[object object]" if you just log the error object
vjs.log.error('(CODE:'+this.error_.code+' '+vjs.MediaError.errorTypes[this.error_.code]+')', this.error_.message, this.error_);

return this;
};

vjs.Player.prototype.waiting_ = false;
// vjs.Player.prototype.waiting_ = false;

vjs.Player.prototype.waiting = function(bool){
if (bool === undefined) {
return this.waiting_;
}
// vjs.Player.prototype.waiting = function(bool){
// if (bool === undefined) {
// return this.waiting_;
// }

var wasWaiting = this.waiting_;
this.waiting_ = bool;
// var wasWaiting = this.waiting_;
// this.waiting_ = bool;

// trigger an event if it's newly waiting
if (!wasWaiting && bool) {
this.addClass('vjs-waiting');
this.trigger('waiting');
} else {
this.removeClass('vjs-waiting');
}
// // trigger an event if it's newly waiting
// if (!wasWaiting && bool) {
// this.addClass('vjs-waiting');
// this.trigger('waiting');
// } else {
// this.removeClass('vjs-waiting');
// }

return this;
};
// return this;
// };

vjs.Player.prototype.ended = function(){ return this.techGet('ended'); };
vjs.Player.prototype.seeking = function(){ return this.techGet('seeking'); };
Expand Down

0 comments on commit 11ca9cd

Please sign in to comment.