Skip to content

General JavaScript VGM player discussion

Technical discussion about the VGM format, and all the software you need to handle VGM files.

Moderator: Staff

  • User avatar
  • neologix Offline
  • Posts: 211
  • Joined: 2012-04-22, 4:03:45
  • Location: New York, NY, USA

Post by neologix »

niekniek wrote:Ok, I guess it's at 95% stable now. I've been updating the post above about my todo list, I'll keep working on that. If you want you can build your own Emscripten 'binary' & data file but you can also get it from http://vlessert.nl/vgmplay-js/
Gives the error "[Error] ReferenceError: Can't find variable: AudioContext - VGMPlay_WebAudio (vgmplay-js-glue.js:137)" on macOS Safari 11.0.1 (High Sierra 10.13.1). Shockingly, I think Safari still uses the prefixed webkitAudioContext for its work, so I'd suggest you have that fallback as well.
  • User avatar
  • niekniek Offline
  • Posts: 71
  • Joined: 2017-07-17, 23:28:35

Post by niekniek »

neologix wrote:Gives the error "[Error] ReferenceError: Can't find variable: AudioContext - VGMPlay_WebAudio (vgmplay-js-glue.js:137)" on macOS Safari 11.0.1 (High Sierra 10.13.1). Shockingly, I think Safari still uses the prefixed webkitAudioContext for its work, so I'd suggest you have that fallback as well.
They do; thx, fixed.

Post by vampirefrog »

what is this ace of base shit
  • User avatar
  • niekniek Offline
  • Posts: 71
  • Joined: 2017-07-17, 23:28:35

Post by niekniek »

vampirefrog wrote:what is this ace of base shit
lol, don't you like it? :D :D It's from Sonyc, MSX obviously, it's on vgmrips.

Post by vampirefrog »

how's this project going?
  • User avatar
  • niekniek Offline
  • Posts: 71
  • Joined: 2017-07-17, 23:28:35

Post by niekniek »

vampirefrog wrote:how's this project going?
Well, my todo list is somewhere on page 3. On it is nothing that's really required imo. So I guess it's ready for review and hopefully integration.

Post by vampirefrog »

sounds good, thx
  • User avatar
  • niekniek Offline
  • Posts: 71
  • Joined: 2017-07-17, 23:28:35

Post by niekniek »

btw, I'm aware of bugs in the progress bar. Works fine when not changing tabs, but when you leave the player, a next track starts and you go back to the player tab it'll probably not work.. but I'm curious how you will approach this. The playback and webaudio part is separated from the graphical and gui stuff.
  • User avatar
  • niekniek Offline
  • Posts: 71
  • Joined: 2017-07-17, 23:28:35

Post by niekniek »

After some experience with the webplayer with my phone I can conclude it has even more issues. For example it won't skip to the next track all the time when the normal playback time has passed. It has probably something to do with the fact that stuff stops when the tab is not active (since the phone is in my pocket, locked), so the callback to the function that starts the next track never happens or much later, whatever the implemented behaviour of Android & Chrome on Android is. I guess something with webworkers is required to fix this, if that'll even work when the phone is locked. Since phones are optimized for battery saving I suppose even webworkers won't work. But then again, playback will stop anyway when Android decides it needs to kill the browser, so the native Android player is always preferred. The question is if the behaviour on the desktop browser is the same. I don't think so, because I'm currently listening and it skips just fine on the other tab. Any thoughts on this?

By the way, the version on Github does not have a fix for the IOS handling of Webaudio, the version on vlessert.nl does; webaudio needs to be activated by a user-initiated event, like with a button, otherwise it just won't work.

Post by vampirefrog »

There is a chrome:// setting to not require user interaction, but because you're using a script callback, perhaps a solution is to just not "stop" the audio stream, just use one audio stream to play multiple tracks.
  • User avatar
  • niekniek Offline
  • Posts: 71
  • Joined: 2017-07-17, 23:28:35

Post by niekniek »

No it won't I guess. :( Chrome on IOS uses the Safari engine, it's not possible to use another then the engine from Apple. So the user interaction logic applies. Btw this also applies to Chrome Canary on other platforms currently.

Post by vampirefrog »

Guess for phones we can create a couple of apps that just use the vgmrips API which doesn't exist.
  • User avatar
  • niekniek Offline
  • Posts: 71
  • Joined: 2017-07-17, 23:28:35

Post by niekniek »

Hey vampirefrog, I've been experimenting a bit more with the javascript player, I've been downloading and extracting zip files in javascript so I can just input a vgmrips.net archive. My conclusion is that it works fine, but it just takes too long to download and extract the files in memory and start playback for a nice user experience. I can code a lot around that with offline storage and everything, but it'll simply be never like the mp3 files.

So for smooth playback of the whole vgmrips archive I would need direct access to the all vgz files. Would you think it's possible to offer that with decent performance through some PHP code?

Post by vampirefrog »

The site already does that. It extracts one file on the server side wiht a php script: http://vgmrips.net/packs/vgm/Other/The_ ... 20Lair.vgz

If you want to emulate this behavior, you can write a simple php script with ZipArchive that takes the name of the zip and the name of the file to be extracted. I think you can use the zip_open() example from here. If you want I can write it for you.
  • User avatar
  • niekniek Offline
  • Posts: 71
  • Joined: 2017-07-17, 23:28:35

Post by niekniek »

Nice! I can manage, but I guess I can't use this right away in javascript because of the cross domain XHR thing?

I might be able to do it in php with a post...?
Post Reply