Permalink
Browse files

Fix playlist error handling after api.load

This bug manifested when calling api.load on a playlist of which all sources get
filtered out. For example, an rtmp file on an android chrome.

In this case, the player was not going to an error state, instead it was sending
an error through the mediaController. The solution was to send the error through
the actual model.

JW7-1783
  • Loading branch information...
donato committed Nov 12, 2015
1 parent 8e97305 commit 7964d9534724e4f94d07637c491fd85f3ae00590
Binary file not shown.
@@ -238,8 +238,10 @@ define([
_loadPlaylist(item);
break;
case 'object':
_setPlaylist(item);
_setItem(0);
var success = _setPlaylist(item);
if (success) {
_setItem(0);
}
break;
case 'number':
_setItem(item);
@@ -403,12 +405,14 @@ define([
_model.set('playlist', playlist);
if (playlist.length === 0) {
_model.mediaController.trigger(events.JWPLAYER_ERROR, {
if (!_.isArray(playlist) || playlist.length === 0) {
_this.triggerError({
message: 'Error loading playlist: No playable sources found'
});
return;
return false;
}
return true;
}
function _setItem(index) {
@@ -139,15 +139,13 @@ define([
var playlist = _model.get('playlist');
// Performs filtering
_setPlaylist(playlist);
var success = _setPlaylist(playlist);
playlist = _model.get('playlist');
if (!_.isArray(playlist) || playlist.length === 0) {
_playlistError(resolve, 'Playlist type not supported');
return;
if (success) {
resolve();
} else {
_playlistError(resolve);
}
resolve();
}
function _playlistError(resolve, evt) {

0 comments on commit 7964d95

Please sign in to comment.