Shapediver Embedding with iframe | error:SDVReflector is not defined


(Martin Wiesner) #1

Dear Shapediver team,

i am trying to integrate a shapediver model over an iframe into a django web-app.
I’ve got a Pro account of shapediver and i used the embedding code out of my model and i uncommented the line for api access as written in the documentation.

The viewer loads the model correctly But I get the error when trying to call the parameters in the console:

SDVReflector is not defined

I’ve also tried it in parallel with a simple Wordpress page, with the same problem.
I’m sure it is really a basic issue but at the moment I am really struggling with it.

Thank you very much and best regards!

Martin


(Alexander Schiftner) #2

The SDVReflector object gets defined as soon as the first message is received from the iframe. It’s important that the id of the iframe is sdv-iframe or sdv-frame, others are ignored.
You might be running into a timing problem. Please try to move the script tag for the sdv_reflector.min.js to a place before the iframe.


(Martin Wiesner) #3

thank you very much for the answer!

i tried this. But it seems to stay the same problem at least if i understood it right. I’m honestly not a devoloper, i’m a designer, sorry about my silly problems.

When i put it in JS bin i get at least an answer in the console:

But this wasn’t the answer i expected

api=SDVReflector.get(‘api’)
[object Object] {
addEventListenerAsync: function(){var c=Array.prototype.slice.call(arguments),d=module$src$shared$util$GlobalUtils.default.ArrayToObject©;
if(p(d)){console.log(“argsobj needs reflection:”,d);var e=module$src$shared$util$GlobalUtils.default.createRandomId();return k(d,e,!0).then(function(){return m({id:a,command:b,arguments_id:e})})}return m({id:a,command:b,arguments:c})},
apps: [object Object] {
controls: [object Object] { … },
domElements: [object Object] { … },
exportModal: [object Object] { … },
overlays: [object Object] { … },
settings: [object Object] { … }
},
clearProcessCallbackAsync: function(){var c=Array.prototype.slice.call(arguments),d=module$src$shared$util$GlobalUtils.default.ArrayToObject©;
if(p(d)){console.log(“argsobj needs reflection:”,d);var e=module$src$shared$util$GlobalUtils.default.createRandomId();return k(d,e,!0).then(function(){return m({id:a,command:b,arguments_id:e})})}return m({id:a,command:b,arguments:c})},
createAsynchronousFunctionsAsync: function(){var

Could you perhaps please help me a little bit more.
Perhaps it is easier with this js bn thing.

best regards an thanks in advance!


(Alexander Schiftner) #4

Doesn’t seem like a problem, your call to api=SDVReflector.get('api') seems to have succeeded as expected. This gives you the api object to use for controlling the viewer. As an example, you can go ahead now and change parameters, control the camera, etc
An example to start with:


(Martin Wiesner) #5

awesome! i managed to get it to work in the JsBIN for one single parameter

Still it does not work in wordpress or in the django web app.
What could be the potential reasons?

best regards and thank you very much!


(Alexander Schiftner) #6

There are a trillion reasons why this might not be working in your specific setup :wink:
If you post a publicly accessible link to your example we might be able to help you.