Update to publishing [BREAKING]


#1

Hi all,

A small announcement to let you know about changes that we’ve made to publishing today. It’s a small change but has a few important effects.

The change
We now serve all published pages from the playcanv.as domain. Previously we served the main wrapper page. i.e. the primary app: https://playcanv.as/p/12345678 or a build https://playcanv.as/b/12345678, but these pages were mostly an iframe that wrapped the application content and this was not served from the same domain. This led to some problems where certain features (e.g. device motion events on iOS) would not work due to cross-domain security, i.e. the browser was blocking the events because the page was on playcanv.as but the code was running from someotherdomain.com.

This change fixes this issue and also lays a path for us to better support CDN content and load all asset content faster.

Fixes

  • Device motion and Device orientation events now work on iOS. issue
  • Consequently the WebVR tracking works correctly on iOS. issue
  • Embedding PlayCanvas apps in some services (e.g. Facebook) now works more easily

Breaking Changes

In order to implement this change we have separated the domain from which the application is served (playcanv.as) and the domain from which the assets are served (a non-fixed CDN type domain). In 99.9% of use-cases this will not affect your application. There are two cases where it will and you will need to make a small change to fix your application when publishing to playcanvas.

  1. If you load assets using asset.file.url. For example you create an HTML image element and set the src property to be asset.file.url. This will no longer work as asset.file.url is a relative path and will no longer point to your asset. Change any reference of asset.file.url to asset.getFileUrl(). asset.getFileUrl() returns the absolute path to the asset on the correct domain.

  2. If you are loading an asset using an HTML image tag and then using this image as a texture. You will need to add crossOrigin=“anonymous” to your image element. Note, this only applies if you are loading the image yourself. Using the PlayCanvas asset system will work with no modification.

If you have any questions about this feature or how to fix your application please get in touch.