Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement seeking #4

Closed
devongovett opened this issue Jul 4, 2012 · 9 comments
Closed

Implement seeking #4

devongovett opened this issue Jul 4, 2012 · 9 comments

Comments

@devongovett
Copy link
Member

No description provided.

@jussi-kalliokoski
Copy link
Member

+1

@geoffjukes
Copy link

+1 - I don't usually post like this, but seeking, either in chunks (+/- 5 seconds) or in slider form would be extremely useful.

@comster
Copy link

comster commented Jul 25, 2012

+1 me too

@gmaliar
Copy link

gmaliar commented Jul 30, 2012

+1

:-)

@indiloop
Copy link

indiloop commented Oct 2, 2012

+1

Would it be possible to somehow start decoding from a arbitrary position in an mp3 file. I'm trying to implement real time decoding of an mp3, so I can feed the decoded pcm data directly into a JavascriptAudioNode's output.

//example

var startTime = 5; // in seconds

var byteOffset = timeToByte(startTime); // convert seconds to byte location?

asset.on('decodeStart', function() {
var list = new BufferList;

asset.on('data', function(buffer) {
list.push(new Buffer(buffer));
asset.decoder.readChunk();
});

asset.decoder.readChunk();
}, byteOffset);

asset.start();

I'm fairly new to this type of low level audio programming, so if this is way off base please let me know. :)

@boatmeme
Copy link

boatmeme commented Oct 7, 2012

+1

@devongovett
Copy link
Member Author

As of 2ec2d60, basic support for seeking has been added to the namespace branch. It works fairly well as long as you don't try seeking to part of a file that hasn't been loaded yet - still need to work on that.

Basically, uncompressed formats seek by using the format's bytesPerPacket and framesPerPacket properties, and compressed formats seek using a seek table generated by the demuxer. The player converts the timestamp from milliseconds to a sample number, and asks the decoder to seek to that sample number. In turn, the decoder asks the demuxer for a seek point closest to the given sample and jumps to that offset, and playback resumes at the new time.

Let me know if you have improvements or suggestions. Leaving this open for now. Cheers!

@karlbloedorn
Copy link

Will the changes for seeking be moved into master? I noticed that this project has been inactive for 3 months. Is there a reason development has fallen off?

@devongovett
Copy link
Member Author

Yes, they will. I've just been busy with other things lately. I'll get to it soon, but for now, I'd suggest just using the namespace branch instead of master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants