KR Pano Virtual Tours on Android

  • Hi

    I have had a bunch of virtual tours running for a while now but havent looked at them for a few years but need to sort them out as I am now getting problems. I have them set up like at the bottom so if it detects IOS it will run a completely different version of the tour. If it doesn't it runs the Flash Panorama Player of the tour.

    This used to work fine when Android ran Flash properly but now it doesn't on a lot of devices, so would the easiest way be to add a user String so if it detects Android it will run the Krpano version
    This will leave it running the FPP version just on desktops which is fine I think - or should I abandon that and just have the KRPano versions running for everything, though I do have a lot of functionality in the fpp tours that still provide a lot of value on desktops so I dont want to give that up unless absolutely necessary.

    And what would the detect script be, just to detect generic Android devices.

    Script I use to emded the krpano tours also below

    I've also noticed if I directly run the krpano versions on my Android phone it doesn't work either, like it's still running flash. Is this bit the problem?

    Code
    <script>
    embedpano({swf:"tour.swf", xml:"tour.xml", target:"pano"});
    </script>

    I haven't changed anything since 2015 so I have old versions of tour.js and tour.swf running and have a full license.

    Any advice greatly appreciated.

    Thanks in advance

    --------------------------------------------------------------------------------------------------------


    CODE THAT RUNS FPP TOURS, DETECTS IOS AND SWITCHES TO ANTOHER TOUR IF FINDS IT

    CODE THAT RUNS IOS TOURS

  • My solution in the day would have been:

    Code
    if (swfobject.hasFlashPlayerVersion("9")) {
            (Code to run flash tour)
        } else {
            (Code to run non-flash tour)
        }


    Also, your embed code should have a html5 parameter.

    Code
    embedpano({swf:"tour.swf", xml:"tour.xml", target:"pano", html5:"auto"});


    However, magnificent a framework as FPP was, it is long past time to move on. Even Trausti would agree. Even if you have written custom Flash plugins for FPP there is very little that KRPano can't do to offer the same functionality with Klaus' incredibly flexible programming language. And you can still write custom Flash and JS plugins when needed. The biggest shortcoming, IMO, is in sound. That said, the included sound player is fine for 92.6% of tours. If you aren't using custom Flash plugins with FPP I can't imagine what functionality you would loose moving to KRPano.

    You must upgrade to the current version of KRPano for everything to work properly on iOS and Android devices today. Do it now.

  • Hi Scott

    Great, many thanks. Big help! Updated and got the krpano tours running on Android. Think I'm gonna stick with the flash tours for desktops for a bit longer and use the detect code you gave me if it doesnt find Flash. I dont have the time currently to redo the functionality for the krpano ones and analytics says 30% of viewers are still using desktop so worth it for now.

    Only problem now is can't get it to detect flash (using the code below) Works on desktop (with flash). On Android (Samsung Galaxy j5) just get a black screen like its not seeing the else statement and redirecting to the ios tour (ios/tour.html)

    Any ideas?

    Many Thanks :)

    Einmal editiert, zuletzt von masten (7. Juni 2017 um 11:53)

  • Only problem now is can't get it to detect flash (using the code below) Works on desktop (with flash). On Android (Samsung Galaxy j5) just get a black screen like its not seeing the else statement and redirecting to the ios tour (ios/tour.html)


    I don't see where you load the swfobject.js. You need to do that to use it. Make sure you are doing that before running you detection script.

  • Hi Scott,

    Yeah it's there you couldn't see it as it was wrapped off page. I've edited it so you can see. It must be loading mustn't it? - as the fpp tours run on desktop ok. It's just not detecting when it's not there.

    Cheers :) M

  • Sorry. I missed lots that should have been obvious yesterday.

    All your JS needs to be inside the script tag:

  • Hi Scott

    Ok thanks, still can't get it to work though. With the code below it now doesn't load the fpp tour on desktop either. Just a black screen in Firefox on desktop, and Android. I'm not a coder so it's probably some small syntax I can't see. What have I got wrong?

    Thanks :) M

  • Right after you load swfobject add the following code:

    Code
    <script type="text/javascript">
            if (swfobject.hasFlashPlayerVersion("9")) {
                alert("WE GOT FLASH!!");
            } else {
                alert("Ah...no flash");
            }
        </script>


    IF SWFObject is loaded you will get one of the two alerts telling you if you have Flash. If there are no alerts SWFObject is not loaded. The path may be incorrect.

    If you get the appropriate alert delete the above code and modify your script as follows:


    The appropriate alert should fire. If you aren't getting the results you expect there is something wrong somewhere else in your code.

  • Hi

    Ok thanks. Yeah tried

    <script type="text/javascript" src="swfobject.js"></script>
    <script type="text/javascript">
    if (swfobject.hasFlashPlayerVersion("9")) {
    alert("WE GOT FLASH!!");
    } else {
    alert("Ah...no flash");
    }
    </script>


    and there's no alert messages, but the swfobject must be loading as the FPP tours run fine if you take out the if, else statements from this:

    <script type="text/javascript">
    if (swfobject.hasFlashPlayerVersion("9")) {
    var so = new SWFObject("tour.swf", "tour", "100%", "100%", "8");
    so.addParam("allowFullScreen","true");
    so.addParam("scale", "noscale");
    so.addVariable("xml_file","tour.xml");
    so.addParam("allowScriptAccess","sameDomain");
    so.addParam ("bgcolor", "#000000");
    so.write("flashcontent");
    } else {
    location.href='ios/tour.html';
    }
    </script>

    So I don't know? It seems to be the detector statement not working. Could it be SWF Object Version. I have 1.5.

    I've PM'ed you some links

    Thanks much Scott

    M

  • I've also just tried this i.e detect IOS & Android to redirect and run the KRPANO tours if it finds

    <script language="javascript" type="text/javascript">

    if( /Android|webOS|iPhone|iPad|iPod|Opera Mini/i.test(navigator.userAgent) )
    {
    location.href='ios/tour.html';}
    }

    </script>

    But doesn't work on my phone which clearly has Android in the User Agent

    Nothing seems to work

    Thanks

    M

  • Hi.

    Ok yeah, updated to 2.3 (couldn't find 2.2) and it detects flash, but the tours don't load. I think because the syntax is different but I couldn't find anything that explains it properly. The references are all too technical for me to understand what's going on.

    Do you know what the new syntax'd be for this

    <div id="flashcontent"> </div>
    <script type="text/javascript">
    var so = new SWFObject("tour.swf", "tour", "100%", "100%", "8");
    so.addParam("allowFullScreen","true");
    so.addParam("scale", "noscale");
    so.addVariable("xml_file","tour.xml");
    so.addParam("allowScriptAccess","sameDomain");
    so.addParam ("bgcolor", "#000000");
    so.write("flashcontent");
    </script>

    Thanks again

    M

  • Here is some code from when I was using this method:


    Adjust paths, names etc to your need

  • Hi Scott,

    Ok thanks for that and all your help, I really appreciate it. I couldn't get that to work though as really tbh, I'm out of my depth with it. So I've decided to scrap the Flash tours, as you initially suggested - should've taken your advice!

    Got them all working apart from one thing - the Google Analytics plug-in now only detects the first scene of the tours. I've changed nothing except bringing the KRPano .js and .swf files up to date, so would I need an updated Google Analytics plugin js file for this to work with those? I have the one from 2013

    Problem is on here https://krpano.com/plugins/userplugins/googleanalytics/ , the update link is down http://jaydee.ru/kp/updates/

    Do you have a copy of that file if that's not available anymore - or would I need to use another plugin?

    Here's the code I have. Was working and detecting all scenes before KRPano updates.

    Many thanks. M

Jetzt mitmachen!

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