Back to Player SDK

By default, if you fetch claraplayer.min.js, and call fetch with only the scene id, you will always get the latest published version of the player, as well as the latest version of the scene.

By referencing a specific version of the player, as well as a specific published version of your scene, you can be confident that changes to the player or your scene will not impact you. Since these assets can be loaded directly from our CDN, the loading speed will also improve.

Get the javascript

The player can be loaded with a specific version from the cdn, change the version as appropriate See the Changelog for published versions.

<script src="https://dh98j2ed63lww.cloudfront.net/js/claraplayer-X.YY.ZZ.min.js"></script>

Publish your scene

Call the clara.io api endpoint POST /api/scenes/{uuid}/publish for publishing your scene: https://clara.io/learn/sdk/api/publish-scene

This will return a json object with four keys: hash, version, formatVersion and jobId.

Load your scene from the published version.

Call fetch or fetchAndUse with the hash value as the second parameter. This will fetch the scene straight from the CDN, bypassing the api call.

var clara = claraplayer('clara-embed');
clara.sceneIO.fetchAndUse(sceneId, hash);

A note on versioning

When the scene is published, the result is a scene with operators and parameters that the current version of the player knows how to handle. When the player learns new operators or parameters, the player formatVersion will be incremented. When the formatVersion has been incremented, it will be necessary to republish the scene in order to take advantage of new functionality added to the player.

We will strive to ensure that new versions of the player will be able to load older published scenes. Similar, we will try to ensure that older players will still be able to load newer published scenes. Any changes to the backwards compatibility of this format will be noted in the Changelog.