BUG: video plugin cannot be set & playvideo() action is broken (1.19 pr3)

  • -version 1.19 Prerelease 3-
    Hi,

    All I want to do is load dynamic videos into my dynamic hotspots that are all generated with a js loop.

    embedpano({swf:"../../krpano/krpano.swf", html5:"prefer", initvars:{panoId:singleResponse.data.id} , xml:"../../krpano/krpano.xml", target:"spherekrpano" , onready:krpanoReady});

    //i grab json here

    requestFactory.getRequest('/extern/getPanorama.json', null )
    .then(function (response) {
    var data = response.data;

    function krpanoReady(krpano)
    {
    var panosTillNextRow = 3;
    var tyCtrl = -200;
    var txCtrl = -600;
    for (var d in data) {
    data[d].id = d;
    sphereList.push(data[d]);

    //Generate menu tiles for videos
    if (data[d].type === 'video') {
    panosTillNextRow --;

    //Create plugin to play dynamic video
    krpano.call("addplugin(video" + data[d].id + ");");
    krpano.call("set(plugin[video" + data[d].id + "].keep,true);");
    krpano.call("set(plugin[video" + data[d].id + "].url.flash,%SWFPATH%/plugins/videoplayer.swf);");
    krpano.call("set(plugin[video" + data[d].id + "].url.html5,%SWFPATH%/plugins/videoplayer.js);");
    krpano.call("set(plugin[video" + data[d].id + "].videourl.no-ios,/panorama/"+ data[d].id +"/video-1920x960.mp4|/panorama/"+ data[d].id +"/video-1920x960.webm);");
    krpano.call("set(plugin[video" + data[d].id + "].videourl.ios,/panorama/"+ data[d].id +"/video-1344x672.mp4|/panorama/"+ data[d].id +"/video-iphone-sound.mp3);");
    krpano.call("set(plugin[video" + data[d].id + "].loop,true);");
    krpano.call("set(plugin[video" + data[d].id + "].pausedonstart,true);");
    krpano.call("set(plugin[video" + data[d].id + "].visible,false);");
    krpano.call("set(plugin[video" + data[d].id + "].use_as_videopano,true);");

    krpano.call("set(plugin[video].videourl.no-ios,/panorama/"+ data[d].id +"/video-1920x960.mp4|/panorama/"+ data[d].id +"/video-1920x960.webm);");
    krpano.call("set(plugin[video].videourl.ios,/panorama/"+ data[d].id +"/video-1344x672.mp4|/panorama/"+ data[d].id +"/video-iphone-sound.mp3);");

    //Create hotspots for menu tiles
    krpano.call("addhotspot(panoThumbnail" + data[d].id + ");");
    krpano.call("set(hotspot[panoThumbnail" + data[d].id + "].distorted, true);");
    // krpano.call("set(hotspot[panoThumbnail" + data[d].id + "].enabled, false);");
    krpano.call("set(hotspot[panoThumbnail" + data[d].id + "].url, /panorama/" + data[d].id + "/thumb.png);");
    krpano.call("set(hotspot[panoThumbnail" + data[d].id + "].tx,"+ txCtrl +");");
    krpano.call("set(hotspot[panoThumbnail" + data[d].id + "].ty,"+ tyCtrl +");");
    krpano.call("set(hotspot[panoThumbnail" + data[d].id + "].depth,2000);");
    // krpano.call("set(hotspot[panoThumbnail" + data[d].id + "].onclick, plugin[video].play(););");

    // Loads actual video in network but doesnt play it
    // krpano.call("set(hotspot[panoThumbnail" + data[d].id + "].onclick, plugin[video].playvideo(/panorama/"+ data[d].id +"/video-1920x960.mp4); plugin[video].play(););");

    //Despite redefining a plugin with the exact traits as klaus' example video plugin, the error WARNING: unknown action: plugin[video77].play .
    // krpano.call("set(hotspot[panoThumbnail" + data[d].id + "].onclick, plugin[video" + data[d].id + "].play(););");

    // Doesn't play. Doesn't load. Doesn't display errors.
    // krpano.call("set(hotspot[panoThumbnail].onclick, set( plugin[video].videourl,/panorama/77/video-1920x960.mp4|/panorama/77/video-1920x960.webm); plugin[video].play(););");

    krpano.call("set(hotspot[panoThumbnail"+data[d].id+"].onloaded, build_pano_tiles(); ");
    krpano.call("set(hotspot[panoThumbnail" + data[d].id + "].onclick, plugin[video].play(););");

    //set horizontal position for next menu tile
    txCtrl += 600;

    //Make panels on next row
    if (panosTillNextRow < 1) {
    tyCtrl += 600;
    txCtrl = -600;
    panosTillNextRow = 3;
    }
    }

    }
    Unfortunately, the video plugin given in the example found at https://krpano.com/download/?version=119pr3 cannot be altered in anyway, especially using JS.

    First let me show you the existing <plugin name='video'/> inside viewer/examples/webvr/krpano.xml:

    <plugin name="video" keep="true"
    url.flash="%SWFPATH%/plugins/videoplayer.swf"
    url.html5="%SWFPATH%/plugins/videoplayer.js"
    videourl.no-ios="/panorama/%$panoId%/video-1920x960.mp4|/panorama/%$panoId%/video-1920x960.webm"
    videourl.ios="/panorama/%$panoId%/video-1344x672.mp4|/panorama/%$panoId%/video-iphone-sound.mp3"
    loop="true"
    pausedonstart="true"
    visible="false"
    use_as_videopano="true"
    />

    onclick of a hotspot I would like this videourl.no-ios to change however this is impossible to set. Watch.
    krpano.call("set(hotspot[panoThumbnail].onclick, set( plugin[video].videourl.no-ios,/panorama/77/video-1920x960.mp4|/panorama/77/video-1920x960.webm); plugin[video].play(););");

    According to the docs, the plugin's videourl.no-ios should be set to this new url but this does not work.

    Additionally, generating alternative video plugins, with seperate videourls cannot be created either because I receive the error WARNING: unknown action: plugin[video77].play


  • Device attribute settings are NOT for dynamic code like that. They are used at the start via xml parsing.

    use ifnot(device.ios, set(plugin[video].videourl instead of set(plugin[video].videourl.no-ios,

    A bit silly that i cant set the attribute by videourl.no-ios and must instead use only videourl, but this works partially so thanks.

    One problem is that this solution DOESNT work with the sound mp3 files that is needed to play video sound on ios


    <action name="playtest3">
    ifnot(device.ios, set(plugin[video].videourl, /panorama/77/video-1920x960.mp4); ,
    set(plugin[video].videourl, /panorama/77/video-1344x672.mp4|/panorama/77/video-iphone-sound.mp3););
    ifnot(device.ios, plugin[video].playvideo(/panorama/77/video-1920x960.mp4);, playvideo(/panorama/77/video-1344x672.mp4|/panorama/77/video-iphone-sound.mp3););
    plugin[video].play();
    </action>

    video-1344x672 for ios is being called but video-iphone-sound.mp3 is NOT *confused*

  • Inframatic, all works just fine, i know.
    You make some mistakes.
    It is not silly, the videourl.ios stuff etc..
    But you need to understand how things work.

    Tuur *thumbsup*

Jetzt mitmachen!

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