[SOLVED] Using PlayCanvas for a Playable Ad?

Hi guys, I’m attempting to use PlayCanvas to create a playable ad on mobile devices. I’ve got the tech specs from the ad networks and a lot of them require the assets inline and everything inside a single HTML file, I was wondering if anyone has had any success doing this?

I’ve used Node.js inliner to bring it into a single html file but the engine just fails, seemingly trying to load the json and I would imagine the rest of the assets.

I’ve had a look at the engine and it seems to do all the asset requests via http through the json config, it seems like I’d have to modify the engine quite heavily if I wanted to meet the ad network tech specs.

I don’t seem to be able to find any information on PlayCanvas as a playable ad engine and nothing on it’s compatibility with MRAID, am I wasting my time trying to use PlayCanvas to create a playable ad?

I did a contract job for a Playable ad (although they were an ad network themselves) but didn’t require it to be a single HTML file.

It’s going to be tricky to do this via the Editor as even just an empty project will have a scene JSON file.

The only way I can see it working is if you use PlayCanvas as an engine only or write a custom post build script that inlines everything including all the URL references within the assets and scenes.

I’m a little surprised that you are the first to raise this issue if it’s a requirement of ad networks :thinking:

Maybe @dave or @will have better ideas?

Not really - you’ve summed it up perfectly, @yaustar! :slight_smile:

Hi guys,

Has anything changed since the last reply?
Is it still impossible to have single file export?

1 Like

The situation is still the same. It’s only really practical to do this if you use the Engine directly. Export of a PlayCanvas app from the Editor does no inlining of assets and it would be complicated to post-process an Editor-generated app to exist in a single file.

1 Like

Well, I tried to solve the problem and almost succeeded. All the files exported from the editor can be bundled into HTML file directly (in case of js/css files) or as data-uri params (images, JSONs etc).
The only problem I faced are loading assets.

When I try to pass data-uri string instead of normal URL in config.json file,

it causes an error (“No mode parser found for …”) :

Would be good to have a possibility to use, for example, ‘dataUri’ field instead of ‘url’ field into

assets.{asset_name}.file 

section of config.json, like this:


The current revision doesn’t pay attention to the data-uri requests and tries to load them via GET request, what is obviously wrong:

P.S. You guys were discussing bundled assets, right? Is there any info how to use this feature?

2 Likes

Great work! Is there a possibility to patch this on the engine so it can handle a dataURI if present?