From: Rick Waldron Date: Wed, 3 Aug 2011 18:51:50 +0000 (-0400) Subject: [#675] Check registry for potentially removed plugins X-Git-Tag: v0.8^2~14^2~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=c7d774311e2b494b066d71b33cdcfa79ae7de8d4;p=popcorn-js.git [#675] Check registry for potentially removed plugins --- diff --git a/popcorn.js b/popcorn.js index fb6cb93..5644774 100644 --- a/popcorn.js +++ b/popcorn.js @@ -177,6 +177,7 @@ // Playback track event queues trackEvents: { byStart: [{ + start: -1, end: -1 }], @@ -219,7 +220,10 @@ while ( tracksByEnd[ tracks.endIndex ] && tracksByEnd[ tracks.endIndex ].end <= currentTime ) { // If plugin does not exist on this instance, remove it - if ( !tracksByEnd[ tracks.endIndex ]._natives || !!that[ tracksByEnd[ tracks.endIndex ]._natives.type ] ) { + if ( !tracksByEnd[ tracks.endIndex ]._natives || + ( !!Popcorn.registryByName[ tracksByEnd[ tracks.endIndex ]._natives.type ] || + !!that[ tracksByEnd[ tracks.endIndex ]._natives.type ] ) ) { + if ( tracksByEnd[ tracks.endIndex ]._running === true ) { tracksByEnd[ tracks.endIndex ]._running = false; tracksByEnd[ tracks.endIndex ]._natives.end.call( that, event, tracksByEnd[ tracks.endIndex ] ); @@ -234,8 +238,11 @@ while ( tracksByStart[ tracks.startIndex ] && tracksByStart[ tracks.startIndex ].start <= currentTime ) { // If plugin does not exist on this instance, remove it - if ( !tracksByStart[ tracks.startIndex ]._natives || !!that[ tracksByStart[ tracks.startIndex ]._natives.type ] ) { - if ( tracksByStart[ tracks.startIndex ].end > currentTime && + if ( !tracksByStart[ tracks.startIndex ]._natives || + ( !!Popcorn.registryByName[ tracksByStart[ tracks.startIndex ]._natives.type ] || + !!that[ tracksByStart[ tracks.startIndex ]._natives.type ] ) ) { + + if ( tracksBySt art[ tracks.startIndex ].end > currentTime && tracksByStart[ tracks.startIndex ]._running === false && that.data.disabled.indexOf( tracksByStart[ tracks.startIndex ]._natives.type ) === -1 ) { @@ -255,7 +262,10 @@ while ( tracksByStart[ tracks.startIndex ] && tracksByStart[ tracks.startIndex ].start > currentTime ) { // if plugin does not exist on this instance, remove it - if ( !tracksByStart[ tracks.startIndex ]._natives || !!that[ tracksByStart[ tracks.startIndex ]._natives.type ] ) { + if ( !tracksByStart[ tracks.startIndex ]._natives || + ( !!Popcorn.registryByName[ tracksByStart[ tracks.startIndex ]._natives.type ] || + !!that[ tracksByStart[ tracks.startIndex ]._natives.type ] ) ) { + if ( tracksByStart[ tracks.startIndex ]._running === true ) { tracksByStart[ tracks.startIndex ]._running = false; tracksByStart[ tracks.startIndex ]._natives.end.call( that, event, tracksByStart[ tracks.startIndex ] ); @@ -270,7 +280,10 @@ while ( tracksByEnd[ tracks.endIndex ] && tracksByEnd[ tracks.endIndex ].end > currentTime ) { // if plugin does not exist on this instance, remove it - if ( !tracksByEnd[ tracks.endIndex ]._natives || !!that[ tracksByEnd[ tracks.endIndex ]._natives.type ] ) { + if ( !tracksByEnd[ tracks.endIndex ]._natives || + ( !!Popcorn.registryByName[ tracksByEnd[ tracks.endIndex ]._natives.type ] || + !!that[ tracksByEnd[ tracks.endIndex ]._natives.type ] ) ) { + if ( tracksByEnd[ tracks.endIndex ].start <= currentTime && tracksByEnd[ tracks.endIndex ]._running === false && that.data.disabled.indexOf( tracksByEnd[ tracks.endIndex ]._natives.type ) === -1 ) {