我已使用xuggler播放wav,au,aiff以外的音频文件.由于xuggler以较低的级别执行音频解码,因此很难编写一种方法来转发和倒带正在播放的音频. (在解码xuggler时会分析每个数据包,然后将其发送以播放)
I have used xuggler to play audio files other than wav,au,aiff. Since xuggler performs audio decoding at low level it is very hard to write a method that both forwards and rewinds the audio being played . ( while decoding xuggler analyzes each data packet and then sends it to play)
一种方法可以一次读取一堆数据包,然后发送下一个数据包播放.这样可以感觉到转发音频的效果. But i don't know how to implement this method而且,这不是我转发数据的最佳方法.
One way could be read bunch of packets at a time and then send the next packet to play.This way the effect of forwarding audio can be felt . But i don't know how to implement this method Moreover this is not the best way i can forward the data.
是否有直接方法来转发和倒带音频?如果不是直接指定什么算法,该怎么做?
推荐答案您是否看过IContainer中的seekKeyFrame()方法?参见此处.在搜索时,您可以只刷新数据线,然后在执行该方法时,容器应跳至给定位置.
Have you looked at the seekKeyFrame() method in IContainer? See here. On seek, you could just flush the dataline and then on execution of the method the container should jump to the given location.
如果您想通过百分比致电来执行此操作,请 getDuration()获取流的整个长度(如果可用).然后您可以从那里计算出准确的时间戳.
If you want to do it by a percentage call, then getDuration() gets the entire length of the stream (if available.) You can then work out accurate timestamps from there.
更多推荐
在xuggler中转发和倒带音频
发布评论