Sketchfab Forum

IFRAME Switch to VR Cardboard Mode Programtically?

(Glasshandvr) #1

Hate to be a bother but I'm speaking to a panel on the subject of VR shortly and I plan to demonstrate using Sketchfab. I really need to know if I can make Sketchfab come up in VR mode using IFRAME.

I know it can be done using EMBED, but as far as I can tell I don't have access to the scripting mechanism that I get using an IFRAME.

So once again, can this code be modified such that on a mobile device the browser goes directly into Cardboard mode?

<iframe src="" id="api-frame" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" width="1024px" height="548px" style="border: 0px;"></iframe>
<!-- Initialize the viewer -->
<script type="text/javascript">
var iframe = document.getElementById( 'api-frame' );
var version = '1.0.0';
var urlid = '311d052a9f034ba8bce55a1a8296b6f9';
var client = new Sketchfab( version, iframe );

client.init( urlid, {
    success: function onSuccess( api ){
        api.addEventListener( 'viewerready', function() {

            // API is ready to use
            // Insert your code here
            console.log( 'Viewer is ready' );

        } );
    error: function onError() {
        console.log( 'Viewer error' );
} );

split this topic #2

3 posts were merged into an existing topic: Start IFRAME in VR Mode

closed #3