Dynamic videos + audios url via initvars

  • Hi,

    We wish implement the 360° with dynamic videos + audios url. I can't sadly generate on the fly the xml. I use the initvars in the html page and it works great as I dont have the audio file for iphone.
    If I add the audio like below, the url is with both video + audio link > error: loading video failded.

    Code
    <script>	embedpano({initvars:{		myposter:"http://www.metadelic.com/misc/krpano/examples/360/gotthard_video-1024x512.jpg",		mylowvideo:"http://www.metadelic.com/misc/krpano/examples/360/gotthard_video-1024x512.mp4|http://www.metadelic.com/misc/krpano/examples/360/iphone-audio.m4a", 		myhighvideo:"http://www.metadelic.com/misc/krpano/examples/360/gotthard_video-1024x512.mp4|http://www.metadelic.com/misc/krpano/examples/360/iphone-audio.m4a"	},	swf:"360video.swf", xml:"/misc/krpano/examples/360/360var.xml", target:"pano", html5:"auto", mobilescale:1.0, passQueryParameters:true});</script>


    and the call in xml:

    Code
    <action name="add_video_sources">    	videointerface_addsource('1024x512', '%$mylowvideo%', '%$myposter%');    	videointerface_addsource('2560x1280', '%$myhighvideo%', '%$myposter%');</action>


    Can be seen here: http://www.metadelic.com/misc/krpano/360var.html


    If I copy the whole links and paster it in xml for test purpose, they works:

    Code
    <action name="add_video_sources">	videointerface_addsource('1024x512', 'http://www.metadelic.com/misc/krpano/examples/360/gotthard_video-1024x512.mp4|http://www.metadelic.com/misc/krpano/examples/360/iphone-audio.m4a', '%$myposter%');	videointerface_addsource('2560x1280', 'http://www.metadelic.com/misc/krpano/examples/360/gotthard_video-1024x512.mp4|http://www.metadelic.com/misc/krpano/examples/360/iphone-audio.m4a', '%$myposter%');</action>


    How can I use the initvars with a pipe in links in html page to handle 2 resolutions + audio for iphone (same track for both resolutions)?
    Thank you for your input.

    Best regards,
    Dom

  • Hello,

    I've been trying to do dynamic video/xml pages as well.
    In a previous thread a couple pages back:
    How to use dynamic video URLs?

    It mentions that it breaks when you try to pass through the pipe operator "|"
    So to solve it, I leave the pipe inside the xml and split up each file input into it's own initvar to pass.

    Ex:
    HTML/JS

    Code
    initvars:{
    	postername:"gotthard_video-1024x512",
    	videoname:"gotthard_video-1024x512",
    	audioname: "iphone-audio"
    }


    XML

    Code
    videointerface_addsource('1024x512', 'http://www.metadelic.com/misc/krpano/examples/360/%$videoname%.mp4|http://www.metadelic.com/misc/krpano/examples/360/%$videoname%.webm|http://www.metadelic.com/misc/krpano/examples/360/%$audioname%.m4a','http://www.metadelic.com/misc/krpano/examples/360/%$postername%.jpg');

    Of course it's up to you how much of the vars you want to pass through (whether to include the whole url or just file name, extension, etc.)
    Hope this works for you, too!

  • Hi!

    Thx for your reply.

    I've tested with a full url initvars and with the pipe in it. Doesnt work.

    I will now test with the name + path as they change always, like you explain.
    Will come back with the result.

    Regards,
    Dom

  • I correct my page: http://www.metadelic.com/misc/krpano/360var1.html

    it works well but only if you one resolution, asap you have both resolution, you have to split the url/filename.extension aside the pipe.

    Impossible for me to pass the "mp4", as well the "m4a" in a variable in this context, dont know why. So I let it hardcoded as we have only mp4 & m4a for the moment. But will be cool to give the video & audio extension in a variable.
    As well I cant give the absolute url for a poster image, iPas generate a parsing error and can't load it. with a relative, no problem.

    Thanks a lot for your help. I appreciate.

    regards,
    dom

    Einmal editiert, zuletzt von djavet (24. Juni 2016 um 15:39)

  • Hi,

    if you don't want to edit the xml, why not directly using the actions via JS?

    E.g. call in the onloaded event a JS function and in that JS function call the videointerface_addsource and videointerface_play actions from there...

    Btw - great video!

    Best regards,
    Klaus


  • Hi,

    if you don't want to edit the xml, why not directly using the actions via JS?

    E.g. call in the onloaded event a JS function and in that JS function call the videointerface_addsource and videointerface_play actions from there...

    Btw - great video!

    Best regards,
    Klaus

    I'm trying to call the videointerface_addsource in the onloaded event in JS function as you mentioned, but on I get an error on iPhone. Actually, the error happens when the pausedonstart is set to "true".

    Here's what my xml looks like

    and here's a screenshot of the error displayed


  • Post that code too - the error is very probably there.

    Here's the code

    Code
    embedpano({swf:"vendors/krpano/krpano.swf", xml:"vendors/krpano/krpano.xml", target:"pano", html5:"auto", mobilescale:1.0, passQueryParameters:true, onready:krpanoReady, consolelog:true});
    
    
    function krpanoReady(krpano) {	
        krpano.call("videointerface_addsource('video', 'assets/video.mp4', 'assets/poster.jpg'");	
        krpano.call("videointerface_play('video', 'true')");
    }

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!