Jump to content

PIXI + Howler + Webview


Led76
 Share

Recommended Posts

I am trying to load three sounds sprites into my app's Webview (needless to say this works well in Chrome/Firefox etc). The app is in PIXI.

var sound = new Howl({  
     src: ['sound.mp3'],
       sprite: {
       audio: [0,350],
       brush: [350, 16150],
       notep: [16500, 691]
      }
 });

I play the sounds like this:

sound.play('brush');

Instead of hearing the 3 sounds, the whole file is played once. Then if I play the first or the second sound I hear the whole sound file (all 3 sounds). The third one is played correctly after the whole file is played once. Does it have to do with Android's assets? I just use this code in Android Studio, nothing else:

WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.loadUrl("file:///android_asset/index.html");

Anyway, is there any working code, any very simple example I may use for this task? I have lost 2 days for just playing with these three sounds. If there is any other workaround I would be happy to try...

Many thanks

Link to comment
Share on other sites

Hi Ivan.Thanks for the reply. I have tried to use pixi-sound but still had no luck with Webview (all good in Chrome/Firefox). The problem is that I can only load one file, the  others are just ignored/not played at all.

Do you have any working example?

Regards

Link to comment
Share on other sites

I know the issue is very common in Webview, especially in HTML5/JS mobile apps, and probably doesn't have to do with any of the sound libraries but I am sure there must be a way to solve it somehow. The one file limitation is very annoying. Has anyone developed a web app with >1 sound files using PIXI in Android's webview?

Link to comment
Share on other sites

Hi @Led76

PixiSound also supports sound sprites, like Howler. You can see the example here: http://pixijs.io/pixi-sound/examples/sprites.html

With older Android Webview containers, you cannot multitrack audio. You can only have one audio file loaded at a time. If you're building an app, there are many options out there for embedding a Chrome Webview (with more modern features). For instance, if you're using Cordova to build your app, you can use CrossWalk to do this.

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...