vendor/assets/javascripts/webshims/shims/combos/22.js in webshims-rails-1.15.3 vs vendor/assets/javascripts/webshims/shims/combos/22.js in webshims-rails-1.15.4
- old
+ new
@@ -258,14 +258,15 @@
};
var copyProps = ['kind', 'label', 'srclang'];
var copyName = {srclang: 'language'};
var updateMediaTrackList = function(baseData, trackList){
+ var i, len;
+ var callChange = false;
var removed = [];
var added = [];
var newTracks = [];
- var i, len;
if(!baseData){
baseData = webshims.data(this, 'mediaelementBase') || webshims.data(this, 'mediaelementBase', {});
}
if(!trackList){
@@ -296,16 +297,17 @@
for(i = 0, len = trackList.length; i < len; i++){
if(newTracks.indexOf(trackList[i]) == -1){
removed.push(trackList[i]);
}
}
-
+
if(removed.length || added.length){
trackList.splice(0);
for(i = 0, len = newTracks.length; i < len; i++){
trackList.push(newTracks[i]);
+
}
for(i = 0, len = removed.length; i < len; i++){
$([trackList]).triggerHandler($.Event({type: 'removetrack', track: removed[i]}));
}
for(i = 0, len = added.length; i < len; i++){
@@ -313,9 +315,19 @@
}
//todo: remove
if(baseData.scriptedTextTracks || removed.length){
$(this).triggerHandler('updatetrackdisplay');
}
+ }
+
+ for(i = 0, len = trackList.length; i < len; i++){
+ if(trackList[i].__wsmode != trackList[i].mode){
+ trackList[i].__wsmode = trackList[i].mode;
+ callChange = true;
+ }
+ }
+ if(callChange){
+ $([trackList]).triggerHandler('change');
}
};
var refreshTrack = function(track, trackData){
if(!trackData){