Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • keith.grennan

    (@keithgrennan)

    +1 Would love to see proper handling of HTML entities / special chars

    I don’t see any sign of YouTube autoplay support in the click-image-to-load-video mode of FVP (in the current version anyway, I have not used older versions).

    I did my own little hack that seems to work:

    Added the following to my template:

    wp_enqueue_script( 'youtube', 'https://www.youtube.com/iframe_api', array() , '1', true );

    Added this to featured-video-plus/js/frontend.js, at the end of the jQuery.post() handler (line 85 approximately):

    if (/youtube\.com|youtu\.be/i.test(data.html)) {
      var id = $('#DOMWindow iframe').attr('id');
      new YT.Player(id, {events: {onReady: function(event){
        event.target.playVideo();
      }}})
    }

    This snippet checks to see if the video HTML mentions a YouTube domain, and if so uses the YouTube IFrame API to play the video. Seems to work on desktop but i suspect it may not work on mobile, since you usually have to trigger play from a user-generated UI event (click/tap) to autoplay, but that’s a limitation that’s hard to avoid with FVP’s ajax content loading technique. Will do some testing and see. Hopefully this gets fixed in a future version and I can remove my hack.

Viewing 2 replies - 1 through 2 (of 2 total)