WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 6 weeks ago

Last modified 6 weeks ago

#25077 closed defect (bug) (fixed)

Native video player doesn't autoplay when using flash fallback

Reported by: leandroprz Owned by: wonderboymusic
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.6
Component: Media Keywords: needs-patch
Focuses: Cc:

Description

Hi,

I think I found another bug with the new native player.

I'm using this shortcode to show a video:

[video src="video.mp4" width="640" height="360" autoplay="true" loop="true"]

But when using flash it doesn't autoplay or loop the video. It does work fine when using HTML5.

I tested this on a fresh WP 3.6 installation with Twenty Thirteen theme.

Attachments (1)

25077.diff (6.4 KB) - added by wonderboymusic 6 weeks ago.

Download all attachments as: .zip

Change History (7)

comment:1 leandroprz8 months ago

  • Summary changed from Native video layer doesn't autoplay when using flash fallback to Native video player doesn't autoplay when using flash fallback

comment:2 SergeyBiryukov8 months ago

  • Component changed from Embeds to Media

comment:3 wonderboymusic3 months ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 3.9

comment:4 wonderboymusic2 months ago

This might be accomplishable on init, adding something like:

success: function(mediaElement, domObject) {
        // also need to detect 'autoplay' somehow
        if (mediaElement.pluginType == 'flash') {
            mediaElement.addEventListener('canplay', function() {
                // Player is ready
                mediaElement.play();
        }, false);
    }
}

wonderboymusic6 weeks ago

comment:5 wonderboymusic6 weeks ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 27450:

Support the autoplay attribute, even when the plugin type for a MediaElement instance is Flash. In the media modal, wp.media.view.VideoDetails and wp.media.view.AudioDetails now extend a unified wp.media.view.MediaDetails class which contains all of the player creation and destruction logic. The remove() method mimics the mejs.MediaElementPlayer.remove() method, but does not re-add the audio/video tag to the DOM. The MEjs method is especially problematic when the tag has autoplay="true" and the view has been detached but not destroyed.

Fixes #25077.
See #27016.

comment:6 leandroprz6 weeks ago

Thanks for the fix, I just tested it and it's working perfectly.

But still doesn't loop the video. I'm not sure if that's related to this one. Should I create another bug report for that?

Note: See TracTickets for help on using tickets.