Tagged: , ,

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #291964

    Hi I have l list of images that open youtube videos in a lightbox.
    using Avia Layout Builder image and manual URL

    I upgraded to the latest Enfold Version

    And the lightbox function did not work

    If fixed this issue from this support forum.
    https://kriesi.at/support/topic/lightbox-not-working-after-update-2/

    However the youtube URL link will not allow any additional YouTube url controls

    So I had to change
    http://www.youtube.com/watch?v=videokey&rel=0&modestbranding=1&autoplay=1&autohide=1&showinfo=0&fs=1
    to this:
    http://www.youtube.com/watch?v=videokey

    Now when my video is completed playing – I get recommended videos – which I do not want to happen “&rel=0′
    https://developers.google.com/youtube/player_parameters#rel

    https://github.com/dimsemenov/Magnific-Popup/issues/379

    Can you provide a solution – thanks!

    #292301
    #295300

    Hi Josue

    Great I test that one out!

    I have another issue with video not playing in IE8 and IE11

    I had a play around with several plugins
    Jwplayer
    VideoJs
    Sublime
    all have issues with Flash fall back

    Iv’e got a query about the Enfold Built in Avia Layout builder video player
    1. Can I add a Poster image
    2. Can you re-write the workaround script above to work with standard youtube watch video link – so I can have rel=0

    thanks

    #295303

    Hey!

    1. You can set a poster image using the WP video shortcode, reference: http://codex.wordpress.org/Video_Shortcode

    2. The workaround already includes the rel=0 parameter.

    Regards,
    Josue

    #295318

    Hi Josue

    the work around is for the lightbox only

    currently http://youtube.com/watch?= will not use additional parameters either

    I have used a codex [video setup and
    On IE 8 your get the splash graphic you can play – however no video just audio
    ON IE11 you get a black box and when you click on it you get an error message.
    An error occurred, please try again later. Learn More

    Hmmm ….

    So I have just viewed http://mediaelementjs.com/examples/?name=youtube
    on both IE8 and IE11 and everything is fine.

    Just wondering if there is a conflict with ENFOLD Avia layout Builder VIDEO element

    ??

    #295321
    This reply has been marked as private.
    #295354
    #296882

    Hey!

    Unfortunately the magnific popup plugin is quite limited when it comes to youtube urls. The embed url is harcoded in the js source code and you can not change it with the video element or wordpress settings. If you want to add additional parameters like the rel=0 parameter open up wp-content/themes/enfold/js/aviapopup/jquery.magnific-popup.min.js and search for:

    
    //www.youtube.com/embed/%id%?autoplay=1
    

    Add your custom parameters to this url – i.e. like:

    
    //www.youtube.com/embed/%id%?autoplay=1&rel=0&autohide=1&showinfo=0&fs=1
    

    and save the jquery.magnific-popup.min.js file. Afterwards the lightbox should load the right player based on the parameters you added to the url.

    Best regards,
    Peter

    #297128

    Hi Peter
    Thanks for the response.

    Is there away to have that js file read from the child theme ?
    or add additional theme update to include video insert features.

    While waiting for a response I worked on several solutions

    1. A youtube object embed from here ( https://developers.google.com/youtube/youtube_player_demo?hl=fr ) worked fine – but no splash graphic.
    2. I created a simple jquery function that on click hides a div with the splash graphic and shows div with Youtube object embed with auto play – worked fine on desktop – but not on iphone
    3. Our programmer came up with a this to remove the related videos at then end of the video play. Put this code in your Child themes functions.php file

    function remove_related_videos( $html, $url, $args ) {
    
        if ( strpos( $html, 'youtube.com/embed/' ) !== false ) {
            return str_replace( 'feature=oembed','feature=oembed&rel=0', $html );
        } else {
            return $html;
        }
    
    }
    add_filter( 'oembed_result', 'remove_related_videos', 10, 3 );

    4. The final solution was a workaround to use a image as a splash have this link to a manual url = youtube?watch that opened in a lightbox. All done with the Avia layout builder. This worked seamlessly across all browsers in IE8 IE11 and mobile devices with the insertion of the code from this forum into my child theme function.php file.

    https://kriesi.at/support/topic/youtube-video-not-working-in-ligthbox/#post-288867

    Which raises the question…

    why would the mediaelement.js work as a video player cross platform in a lightbox – but not as a page element?

    Now that I have found a work around solution – I’ve lost interest in hacking away at this – may be there will be an improvement with WordPress 4.0

    #299722

    Hey!

    1) Yes, you can use this php code to load a custom js/lightbox script – add it to the child theme functions.php file:

    
    if(!is_admin()) add_action('wp_enqueue_scripts', 'avia_register_child_frontend_scripts', 100, 1);
    function avia_register_child_frontend_scripts()
    {
    	$child_theme_url = get_stylesheet_directory_uri();
    
    	//dequeue default scripts
    	wp_dequeue_script('avia-popup');
    
    	wp_enqueue_script( 'avia-popup',  $child_theme_url .'/js/jquery.magnific-popup.min.js', array('jquery'), 2, true);
    }
    

    and place the modified jquery.magnific-popup.min.js file into a js folder inside your child theme folder (enfold-child/js/jquery.magnific-popup.min.js).

    4) Afaik the lightbox doesn’t use mediaelement.js as the video player but the default youtube/vimeo player which is embedded inside an iframe.

    Cheers!
    Peter

    #662769

    Updated code to remove related videos at the end of Avia youtube url link

    embed_oembed replaced with embed_oembed_html

    Add this to your child theme functions.php file.

     function remove_related_videos( $html, $url, $args ) {
    
        if ( strpos( $html, 'youtube.com/embed/' ) !== false ) {
            return str_replace( 'feature=oembed','feature=oembed&rel=0', $html );
        } else {
            return $html;
        }
    
    }
    add_filter( 'embed_oembed_html', 'remove_related_videos', 10, 3 );
    #662809

    Thanks for sharing the updated snippet @HuxburyQuinn.

    Best regards,
    Josue

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Enfold new light box magnific Popup – you tube video URLS’ is closed to new replies.