Skip to content

Loading…

[#3451] Properly play again if media with greater duration added while p... #1627

Closed
wants to merge 3 commits into from

1 participant

View
5 public/src/editor/media-gallery-editor.js
@@ -148,6 +148,7 @@ define( [ "util/lang", "util/xhr", "util/keys", "util/mediatypes", "editor/edito
function addEvent() {
var start = _butter.currentTime,
end = start + data.duration,
+ playWhenReady = false,
trackEvent;
function addTrackEvent() {
@@ -168,9 +169,13 @@ define( [ "util/lang", "util/xhr", "util/keys", "util/mediatypes", "editor/edito
if ( end > _media.duration ) {
_butter.listen( "mediaready", function onMediaReady() {
_butter.unlisten( "mediaready", onMediaReady );
+ if ( playWhenReady ) {
+ _media.play();
+ }
addTrackEvent();
});
+ playWhenReady = !_media.paused;
setBaseDuration( end );
} else {
addTrackEvent();
View
3 public/src/editor/sequencer-editor.js
@@ -172,6 +172,9 @@ define( [ "util/mediatypes", "editor/editor", "util/time",
}
function updateTrackEvent( options ) {
+ if ( !_butter.currentMedia.paused ) {
+ _butter.currentMedia.pause();
+ }
// If the end time is greater than the duration of the video, expand it to fit.
// We have to set an event listener on "mediaready" to update the trackevent after the base duration has been changed
if ( options.end && options.end > _butter.duration ) {
View
3 public/templates/assets/plugins/sequencer/popcorn.sequencer.js
@@ -88,6 +88,9 @@
clearTimeout( options.loadTimeout );
// If teardown was hit before ready, ensure we teardown.
if ( options._cancelLoad ) {
+ if ( options.playWhenReady ) {
+ _this.play();
+ }
options._cancelLoad = false;
options.tearDown();
}
Something went wrong with that request. Please try again.