Forum » Feedback and Ideas

Please use the new code for embed YouTube videos!

 
    • dblistmu a dit :...
    • Utilisateur
    • 18 avr. 2012, 11h21m

    Please use the new code for embed YouTube videos!

    So far adding a YouTube/YouTu.be URL to a song will internally generate an object block like this:


    <object height="100%" width="100%">
    <param name="movie" value="http://www.youtube.com/v/VIDEO-ID?rel=0&amp;showinfo=0&amp;fs=1&amp;hl=en">;
    <param name="allowFullScreen" value="true">
    <param name="allowscriptaccess" value="always">
    <param name="wmode" value="opaque">
    <embed data="https://www.youtube.com/v/VIDEO-ID?rel=0&amp;showinfo=0&amp;fs=1&amp;hl=en"; src="http://www.youtube.com/v/VIDEO-ID?rel=0&amp;showinfo=0&amp;fs=1&amp;hl=en"; type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" wmode="opaque" height="100%" width="100%">
    </object>



    which is firstly obsolete and secondly it enforces Flash since the older /v/ path does not support HTML5 at all. Unfortunately, it doesn't help converting the link to "/embed/" as the /embed/ path does not work in the block.

    This ist the old embed code you could still use if you select it intentionally on YouTube:

    <object width="560" height="315"><param name="movie" value="https://www.youtube-nocookie.com/v/VIDEO-ID?param=XX"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/VIDEO-ID?version=3&hl=en_US"; type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>



    and this is the new and more readable style:

    <iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/VIDEO-ID"; frameborder="0" allowfullscreen></iframe>

    which will be converted to a HTML5 (WebM) video if you joined the HTML5 trial and still hold the cookie; or if you add the html5=True parameter to all YouTube videos as I do.
    Furthermore, if you consider moving on to the new style I would like you to add YouTube links by default as HTTPS links. As an option you could use the youtube-nocookie.com domain rather than the usual one or at set up a selection to choose from.
    Of course, the best outcome would be if a change reembeds old videos in the new way.

    • kramstan a dit :...
    • Utilisateur
    • 27 avr. 2012, 15h18m
    [youtube]<iframe width="420" height="315" src="https://www.youtube-nocookie.com.com/embed/hhinlzXWQqg?rel=0"; frameborder="0" allowfullscreen></iframe>[/youtube]

    This is what I get still. Why is this not working for me. I followed your instructions but video still won't embed. This is the case whether or not I use youtube formatting script below. Please help! Thanks.

    • DFA1979 a dit :...
    • Abonné
    • 27 avr. 2012, 16h16m
    It's not working for you because you're trying to insert html. The code you've used is what you'd put to embed the video on your own web site (or some other website that allows users to edit html). To embed a video on last.fm, you need to use this format:

    [*youtube]http://www.youtube.com/watch?v=G-qkNEampEA[*/youtube]

    (Remove the stars from the tag, and make sure that you give the address at youtube.com, not the shorter youtu.be version which seems not to work for some reason)

    Click the 'youtube' button beneath the box where you type your post, and it will do this for you automatically.

    • kramstan a dit :...
    • Utilisateur
    • 30 avr. 2012, 9h55m
    That's great. After following your instructions it worked for me! Much appreciated.

    • rfruth11 a dit :...
    • Utilisateur
    • 30 avr. 2012, 19h26m
    thanks all !

Les utilisateurs anonymes ne peuvent pas poster de messages. Merci de vous connecter ou de créer un compte pour pouvoir intervenir dans les forums.