On Monday, October 17, 2016, Morten W. Petersen <morp...@gmail.com> wrote:
>
> On Monday, October 17, 2016 at 5:43:31 PM UTC+2, Brion Vibber wrote:
>>
>> On Sun, Oct 16, 2016 at 3:57 PM, Morten W. Petersen <mor...@gmail.com>
>> wrote:
>>
>>> I thought I'd tell you all that I've worked a bit with Emscripten
>>> lately, and managed to port the
>>> Xiph.org OGG/Vorbis demuxer and decoder using Emscripten.
>>>
>>> The example is here:
>>>
>>> http://blogologue.com/player/
>>>
>>
>> Nice!
>>
>
> Thanks. :)
>
> You might also want to check out my ogv.js project, which plays audio and
>> video from Ogg and WebM files: https://github.com/brion/ogv.js
>>
>
> Yes I did have a look at that as a possible solution for me, but I think I
> found it too big a project,
> as I'm aiming squarely at audio.  At some point I'd like to make decoding
> a lot faster than what
> it is now.
>

Yeah you can make some different trade offs if you're aimed at smaller
audio clips. :)


> I'd like to hear how you handle decoding, buffering etc. though - as
> performance is acceptable
> if 10-second chunks are decoded at a time for example.
>

I'm decoding in realtime (a few packets at a time), maintaining about a 1
second buffer-ahead for audio. The output is done via Web Audio except on
Internet Explorer which uses a Flash shim. This involves jumping through
some hoops but works well for long streams and synchronization with the
video.

Most of my logic is on the JavaScript side, with just demuxer and decoders
in emscripten. For audio, decoding is driven by the Web Audio
ScriptProcessorNode requesting additional data so this works even in a
background tab (video currently uses timers which get throttled, though).

I'm also running decode operations in a Worker thread, so audio decode,
video decode, and playback can run simultaneously. Workers are quite well
supported these days, even on Internet explorer 11... This might be a good
way to halve your decode time if you can split up the file fairly cleanly
into alternating chunks -- dual-core CPUs are virtually everywhere now.

Feel free to follow up in more detail offlist if you like. :) I'm hoping to
make the logic side a little lighter weight and make it work better for the
short audio case too, but I can definitely see some advantages to the
pre-decoded method you're using.



>> Safari for Windows is long-abandoned and isn't representative of Safari
>> on Mac or iOS, unfortunately. To test how things work for actual Safari
>> users you'll need to track down a Mac or iOS device. I can confirm it seems
>> to work in Safari Technical Preview on macOS 10.12.
>>
>
> Yep.
>
> I did find a list of WebKit-based browsers here:
>
> https://en.wikipedia.org/wiki/List_of_web_browsers#WebKit-based
>
> I think testing against one of those will be good enough for a while, as
> Floh reported the player did
> work on Safari now (without me having done any testing against it).
>

Excellent... beware that iOS safari can be a little different than the rest
in terms of media playback, so try to test it too!

-- brion

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to