Code Monkey home page Code Monkey logo

Comments (17)

chris-rudmin avatar chris-rudmin commented on July 21, 2024

The page you linked says android 5+ supports opus in an mkv container. The library is
returning opus in an ogg container.

On Wed, 22 Jul 2015 at 11:15 Diego Mesa [email protected] wrote:

Hello, I'm testing the example on Chrome mobile Android 5.0, it records
ok, but I can't play the recorded file.

According to this doc
http://developer.android.com/guide/appendix/media-formats.html .ogg files
can be played on android.

Do you have any idea?

Thank you


Reply to this email directly or view it on GitHub
#28.

from opus-recorder.

chris-rudmin avatar chris-rudmin commented on July 21, 2024

To make playback work, you could decode the file using oggopusDecoder.js and playback the raw PCM.

from opus-recorder.

alexthewilde avatar alexthewilde commented on July 21, 2024

@chris-rudmin I've been trying to make this work using oggopusDecoder.js as you suggested, but with no success. Could you provide a small example how this could be achieved in combination with an <audio> tag? That'd be absolutely fantastic.

from opus-recorder.

chris-rudmin avatar chris-rudmin commented on July 21, 2024

@alexthewilde To playback in an <audio> tag, will be multi-part process:

  1. Decode the audio using the decoder
  2. Convert Float32 PCM to INT16 and put into WAV RIFF container
  3. Playback wav blobURI in audio tag.

I'll try to post some code samples later on when I get some time.
If you don't need the audio tag, it will be simpler to playback from audio buffers using the web audio API.

from opus-recorder.

alexthewilde avatar alexthewilde commented on July 21, 2024

@chris-rudmin I've been researching this issue a bit more and found hpr.dogphilosophy.net/test/. This test shows that .ogg works natively on Android/mobile Chrome, i.e. without being in a mkv container.

Please have a look at this demo: http://jsfiddle.net/pm84nsdh/3/
The second audio example has been created using your Opus Recorder and it unfortunately doesn't play back in mobile Chrome. As you can see both files are served from the same server and have proper perms etc.

Can you spot any difference in these two ogg files which causes the one to play but not the other?

from opus-recorder.

chris-rudmin avatar chris-rudmin commented on July 21, 2024

Yes, the difference is one file is Vorbis encoded the other is Opus encoded. Ogg is just the container.

https://wiki.xiph.org/OggOpus
http://www.vorbis.com/
http://www.pitivi.org/manual/codecscontainers.html

from opus-recorder.

alexthewilde avatar alexthewilde commented on July 21, 2024

@chris-rudmin thanks for clarifying!

from opus-recorder.

chris-rudmin avatar chris-rudmin commented on July 21, 2024

@alexthewilde Don't despair though, decoding the ogg is not hard. I'll try and post an example tonight.

from opus-recorder.

chris-rudmin avatar chris-rudmin commented on July 21, 2024

Made an example page to decode the file to wav audio. Hope this helps

https://github.com/chris-rudmin/DecodeToWav
http://rawgit.com/chris-rudmin/DecodeToWav/master/example.html

from opus-recorder.

alexthewilde avatar alexthewilde commented on July 21, 2024

@chris-rudmin that's super helpful, cheers! I guess I can make it work from there.

from opus-recorder.

chris-rudmin avatar chris-rudmin commented on July 21, 2024

@alexthewilde if you are reading the file from the server I think you can do it like this to get an arraybuffer:

var oReq = new XMLHttpRequest();
oReq.open("GET", "/myfile.ogg", true);
oReq.responseType = "arraybuffer";
...

from opus-recorder.

diegomesata avatar diegomesata commented on July 21, 2024

How may time can you record in android chrome? I record about 10s and the browser crash down!

from opus-recorder.

chris-rudmin avatar chris-rudmin commented on July 21, 2024

@diegomesata Never tried in mobile. I would assume you are limited by device resources (memory). If you are saving the file to the server in the end, you could try and stream the data as it is encoded instead of storing locally. To do this, you should override recorder.onPageEncoded()

from opus-recorder.

chris-rudmin avatar chris-rudmin commented on July 21, 2024

@diegomesata If you could leave me a stack trace, or whatever error you get, it might be helpful. Perhaps it is something we can fix.

from opus-recorder.

diegomesata avatar diegomesata commented on July 21, 2024

@chris-rudmin today browser doesn't crash down, sorry for the false alarm. At server side what library could I use to decode the ogg to wav?

Edit: My server side is c#. Could it be https://github.com/ioctlLR/NVorbis?

from opus-recorder.

chris-rudmin avatar chris-rudmin commented on July 21, 2024

@diegomesata Personally, I like sox. I think you can run command line stuff in c#. If so you also have the choice of opus-tools.

from opus-recorder.

diegomesata avatar diegomesata commented on July 21, 2024

Thank you for all your help, opus-tools converts the file to wav without problem, but with sox I got: sox.exe FAIL formats: no handler for detected file type `opus'

from opus-recorder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.