Jump to content

suggestion: use new Youtube embed-code


Soraphis

Recommended Posts

Currently the Nexus site uses the old Youtube embed code

it uses object tags and goes like this:

<object width="560" height="315">
<param name="movie" value="//www.youtube.com/v....."></param>
<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>
<embed src="//www.youtube.com/v....." type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>

the problem is it forces you to use the adobe flash player

This is the new embed code
its using iframes so your youtube-settings will be used, and if you (like me) use html5 → the video will be played in the html5 player

<iframe width="560" height="315" src="//www.youtube.com/embed/..." frameborder="0" allowfullscreen></iframe>

its a small change but at least i would be happy :D

btw: i think it would also fix that fullscreen isnt working ; )

Edited by Soraphis
Link to comment
Share on other sites

Might help to further detail it's the File Sites you're talking of.

 

Here in the Forums the "youtube" tag doesn't work, and the "media" tag already translates into the IFrame solution you described.

On the File Sites in descriptions as well as in the Videos tab the "media" tag doesn't work, but the "youtube" tag does, and this one translates into the old "object"-based approach you mentioned.

 

And yes, unlike on the file sites fullscreen works absolutely fine in the IFrame approach used here in the forums.

 

I don't know which software framework is used on the File sites, as it isn't the same as here in the forums, but if there's a version out there supporting the IFrame approach for the "youtube" tag, or a similarly simple fix, it might be worth considering an upgrade at one point in future.

Link to comment
Share on other sites

  • 1 month later...

[edit]

wups to fast : /

need to bugfix it first, seems like it has a problem with the tabbed navigation

edit 2

ok got it, use the userscript if you like (but at own risk)

it does not work after switching through the tabs and back, you may have to reload the page and i dont know why the nexus site is manipulating the url so much while tab-switching

but all these things seem to break the script from working correctly, and im to tired to dig deeper in the nexus page

[/edit]

 

ok, a last bump

on my pc im using firefox and i have no flashplayer so i dont see youtubevideos with the old embed code (with the new my youtube preferences select the html5 code)

 

this bothered me to much tonight so:

if you use greasemonkey add a new userscript

// ==UserScript==
// @name        youtubeEmbed fix
// @namespace   soraphis
// @include     about:addons
// @version     1.1
// @grant       none

// ==/UserScript==
$(document).ready(function(){
    $("object").each(function(){
        var $param = $(this).find('param[name="movie"]');
        if($param.length){
            var $str = $param.attr('value');
            var regex = /^(.)*(youtube.com)(\/v\/)(.*)\&(.)*$/;
            $str = $str.replace(regex, "$4");
            $(this).replaceWith('<iframe width="560" height="315" src="//www.youtube.com/embed/'+$str+'" frameborder="0" allowfullscreen></iframe>');
        }
    });
});

modify it if you want to.

 

this also fixes the video→fullscreen problem

Edited by Soraphis
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...