load a youtube video

  • There are ways to get the url of the video file (.flv) but it violates the terms of youtube. Imagine a website that indexes all those videos, stealing their bandwidth ;)

    But Im not sure if youtube has a crossdomain.xml. Without that you would run into security sandbox errors.

  • There are ways to get the url of the video file (.flv) but it violates the terms of youtube. Imagine a website that indexes all those videos, stealing their bandwidth ;)

    But Im not sure if youtube has a crossdomain.xml. Without that you would run into security sandbox errors.

    Much of the idea with youtube is that you embed the videos on your site, Thats why they have a special Embed link to generate what you need.
    This is something most news sites in the world do. Also large official sites like the Danish Radio do it all the time.

    I have not investigated in what the legal terms say for embedding it inside a flash panorama. I doubt they have anything which describes that.

    But it has of course to be embedded in a frame which you can load the youtube site from.

    Hans

  • Yes thats true. They allow it through their own embedding code. That code generates a player (with play, rewind, mute etc), links to youtube, commercial (income for them), and links to similar videos.

    But krpano doesnt have a youtube player, but a videoplayer. That videoplayer requires a direct url to the source (a flv, mp4 etc). Youtube provides a somewhat encoded url, with some tricks you can find the true url to the flv. But you can imagine that youtube doesnt support or allow for this. All references of youtube would be removed, no links to youtube and no commercials showing. So it would cost youtube only money with nothing in return. You're basicly using youtube for free hosting ;)

    But basicly it's this:
    http://www.abdulqabiz.com/blog/archives/…er-side-script/

    you have a youtube url like:
    http://www.youtube.com/watch?v=V3BsjxDZJM0

    And you rewrite it to:
    http://www.youtube.com/v/V3BsjxDZJM0

    and put that url in the videoplayer. *love*

  • Hi,

    right, the youtube flash videoplayer can be already loaded directly into krpano - just use the url of the video as plugin or hotspot url!

    But to improve the look and optimize the styling I would recommend using additional parameters for the youtube player like version=3 and controls=0...

    e.g. something like that:

    Code
    <plugin name="youtube"
        	url="http://www.youtube.com/v/7pyXV9lv3nY?version=3&amp;autoplay=1&amp;autohide=1&amp;controls=0&amp;loop=0&amp;modestbranding=0&amp;rel=0&amp;showinfo=0"
        	align="center"
        	maskchildren="true"
        	onloaded="registercontentsize(640,390);"
        	/>

    For all parameters for the youtube player please see here:
    https://developers.google.com/youtube/player_parameters

    Look especially for the autoplay and loop parameters to control the playing of the video itself.


    Some additional krpano settings can be used too to make the youtube player better usable:

    1. Use onloaded="registercontentsize(640,390);" to set the correct source size of the youtube player, 640x390 is the correct size for the version=3 player. Without version=3 parameter use 480x360 as size. Note - the size itself inside krpano can be freely defined and changed by the normal krpano width/height/scale settings.
    2. Use maskchildren="true" to hide the informations from youtube that were normally 'scrolling-out' of the view.
    3. If you don't want to let the user interact with the youtube player controls use children="false".


    Here simple example:
    https://krpano.com/examples/youtube/

    And here the xml of it:
    https://krpano.com/examples/youtube/youtube.xml

    The youtube player can be used as <plugin> and as <hotspot> but not as distorted hotspot - youtube prohibits the video bitmap access, but that kind of access would be necessary for distorted hotspots.

    Best regards,
    Klaus

  • Hi,

    Any way to play YouTube videos in the Video player plugin as the 360 panorama?

    No, that's not possible for 'security reasons' - YouTube doesn't allow pixel/bitmap access to the video, but that would be required to be able to distorted/transform the video to a pano!

    I think that restriction should prevent the capturing/copying of the YouTube videos via Flash apps.

    Best regards,
    Klaus

  • Quite nice option! I tried and it works just fine. However, Is there a way to stop the youtube video as well? In my case it is a child to a background pane with close button. Closing the background parent plugin does not stop the video playing obviously, adding removeplugin does not stop the sound, the video seems to be gone though.

    Code
    onclick="close-pane(ui-youtube_blank);removeplugin(youtube-video);"

    In the youtube parameter list I see a start parameter, but no stop parameter (and I wouldn't know how to set that parameter BTW). I tried

    Code
    set(plugin[youtube-video].start,0);

    Any help appreciated very much,

    Michael

  • The youtube player can be used as and as but not as distorted hotspot - youtube prohibits the video bitmap access, but that kind of access would be necessary for distorted hotspots.

    </plugin></plugin>
    Hello Klaus</plugin></plugin>
    in this link youtube player can be distorted </plugin></plugin>http://1.s3.envato.com/files/15254400/preview2.html
    can you look at this sample please.
    best regards.

  • Hi,

    in this link youtube player can be distorted </plugin></plugin>http://1.s3.envato.com/files/15254400/preview2.html
    can you look at this sample please.

    there the video is distorted by the newer Flashplayer 10 internal DisplayObject rotation settings,

    krpano doesn't used them because the core engine is still Flashplayer 9 compatible, and because these settings are slower and more inaccurate then 'directly doing the 3D stuff' and these simple rotation setting doesn't allow an usage in combination with any kind of fisheye distortion because withe them only 3d rotations are possible but no other '3d manipulation'...

    but I think I could add optional support for that... let's see...

    Best regards,
    Klaus

  • Just verifying, that youtube videos, do not appear to work with the videoplayer plugin in any way.

  • Hi Klaus your youtube link don't work on Safari *blink* but on Chrome it's ok

  • Hi,

    that examples embeds the Youtube Flash viewer application, that means that example works only in Flash,
    maybe your Safari is showing the HTML5 version... ?

    Best regards,
    Klaus

    No it is Flash in Safari Desktop.
    But as you say I may see the HTML5 version I do have a question on that.
    Should it not be possible to also receive automatically the Youtube HTML5 version if you use iPad or HTML5 on desktop?

    I am currently doing a large tour for a client who wants to use videos and he also have some on Youtube.
    I have no problem getting them linked from both Bingmaps and the pano but I only get Flash.

    Hans

  • Hello,

    I desperately need some help with presenting some youtube videos in a tour. I reduced the code ever more and still could not make it work. In the end, I used the nearly pure code which Klaus provided a while ago (it had worked for me before). Obviously it still does at the krpano website. But when I try to use it on my server with another youtube video url, it doesn't.

    Code
    <krpano>
    	<plugin name="mask" devices="flash" keep="true" preload="true" url="skin/b_closevideo.png" blendmode="multiply" width="100%" height="100%" enabled="false" zorder="0"/>
    	<preview type="grid(cube,16,16,512,0xCCCCCC,0xFFFFFF,0x999999);" details="16"/>
    <plugin name="youtube" url="https://www.youtube.com/watch?v=ZXQlMgiPd8k?version=3&autoplay=1&autohide=1&controls=0&loop=0&modestbranding=0&rel=0&showinfo=0" align="center" 
    maskchildren="true" onloaded="registercontentsize(640,390);"/>
    </krpano>

    This gives me an XML error in the line with the youtube-url:

    error on line 4 at column 80: EntityRef: expecting ';'

    and a download error in the player

    Any ideas, what's wrong?

    Yours, Michael

    Edited 2 times, last by mstoss (July 24, 2013 at 10:38 PM).

  • Hi,

    the link is wrong - it doesn't point to the embeddable Flash version!

    Youtube links with '.../watch?v=...' are just normal links - see a few posts above for how to rewrite the url.


    Regarding the xml errors - the & characters are normally not allowed in the xml (but the Flashplayer accepts them anyway) - correct would be using &amp; instead of & - see here:
    https://krpano.com/docu/xml/syntaxrules/#characters

    Best regards,
    Klaus

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!