Jump to content

Why Phaser 3 Don't Allow Loading Data URI?


farhan
 Share

Recommended Posts

I just started to play around with Phaser 3.

One major thing, why Phaser 3 Don't Allow Loading Data URI?

Phaser 2 works great with data URI but not Phaser 3.

I found a guide for how to load data uri but there are bunch of missing stuff like how to load a atlas and json spritesheet or how to load sound without json, or how to load video?

I wish Phaser 3 were like 2 which is seamless way to load data uri without needing to use hacky way to them.

The best would be something like Phaser 2, just pass data uri instead of file path.

This would be a great addition for Phaser 3. Not really an addition but re-add :)

I hope there are tutorial in more detail on how to load data URIs.

Link to comment
Share on other sites

Hi @farhan, I'm not Phaser expert (actually, 2 weeks with it :P ), but I'm having issues using load.spritsheet, and in the middle of debugging saw something that maybe will help you:

In the preload method you could try by using the "baseUrl" attribute, like:

preload(){
    this.load.baseURL = 'http://external-url.com/';
}

Give it a try it may work, I'm doing the same to see if that fix my issues :)

Link to comment
Share on other sites

On 9/8/2018 at 5:20 AM, farhan said:

I found a guide for how to load data uri but there are bunch of missing stuff like how to load a atlas and json spritesheet or how to load sound without json, or how to load video?

Hi farhan,

Can you tell me where can I find this "GUIDE"?  I'm using images uploaded by players to play games, those images are stored inside mysql in the form of base64 strings.  I don't know how to load it!  Thanks!

Link to comment
Share on other sites

In the main Phaser site they have a link to this site ;)

https://supernapie.com/blog/loading-assets-as-data-uri-in-phaser-3

I chatted to this person and they say the guide was made based on the project they did, and those are all the only information available for now. If someone else have tried loading other data uri like I mentioned above, it would be great if you can share :D

Link to comment
Share on other sites

On 9/7/2018 at 7:18 PM, Damian Pastorini said:

Hi @farhan, I'm not Phaser expert (actually, 2 weeks with it :P ), but I'm having issues using load.spritsheet, and in the middle of debugging saw something that maybe will help you:

In the preload method you could try by using the "baseUrl" attribute, like:


preload(){
    this.load.baseURL = 'http://external-url.com/';
}

Give it a try it may work, I'm doing the same to see if that fix my issues :)

Thanks for the tip. But I am not loading external assets but in the game code itself because I am making a project where I have to have all assets data in one index. Which is by using data URI not URL ;) it is a base64 data. By using data URI you don't have to provide the image or audio or video files but the data of those files in strings. This is one of the sites I am using to convert images files into base64 data URI. https://www.base64-image.de/

Link to comment
Share on other sites

  • 6 months later...
On 9/12/2018 at 12:42 AM, farhan said:

In the main Phaser site they have a link to this site ;)

https://supernapie.com/blog/loading-assets-as-data-uri-in-phaser-3

I chatted to this person and they say the guide was made based on the project they did, and those are all the only information available for now. If someone else have tried loading other data uri like I mentioned above, it would be great if you can share :D

Hi @farhan I followed this tutorial and was able to add images and sounds successfully. Any idea how I can convert fonts into base64 and then use them in phaser 3.
Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...