I have a custom player that plays back voice recordings (only audio). If the audio file is long the NetStream class does not seek it well. I found out that after 16776 seconds (04:39:36), the NetStream seek function starts again from the beginning of the file. Here is the shortest pseudo code:
package com.name.player
{
import flash.net.NetConnection;
import flash.net.NetStream;
...
public class StreamingPlayer extends Sprite
{
public var maStream:NetStream;
...
public function aFunction
{
maStream = new NetStream( maConnection );
maStream.inBufferSeek = true; // ==> Generates compile error:
//Error: Access of possibly undefined property inBufferSeek through a reference with static type flash.net:NetStream.
// [mxmlc]
// [mxmlc] maStream.inBufferSeek = true;
// [mxmlc] ^
maStream.play('sName', 0, -1, true);
// Now try these (one at a time)
maStream.seek(16775); // Seeks to the desired position and plays the file till the end
maStream.seek(16776); // Seeks at second 0 ( begining )
maStream.seek(16778); // Seeks at second 0 ( begining )
maStream.seek(16780); // Seeks at second 3
maStream.seek(16786); // Seeks at second 9
maStream.seek(16796); // Seeks at second 19
...
}
...
}
...
}
I tried different formats (speex, wav) / codes / bit rate:
- RIFF (little-endian) data, WAVE audio, ITU G.711 A-law, mono 8000 Hz
- RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 44100 Hz
- Ogg data, Speex audio
The file size or total length does not matter, I tried between 1.1 - 1500 MB and between 04:40:00 (17000 seconds) to 14:56:41 (53801 seconds).
I am using html5 for new browsers, but we still need to have support for older browsers (on some client PC's that cannot be updated of install new software, so I need a flash solution for those, because Flash is already installed and running along side IE6 :( ).
Q:
Do I do something wrong or there is a limitation in NetStreamer, and if there is what solution(s) do I have to be able to play these long files ?
P.S. This is my first time working with flash, so please try to be a little more explicit if you have an answer/comment.
EDIT: Added bug at Adobe ID 3492103.
EDIT:
I have a colleague testing the stream server and he found something intersting the the log:
// This is lower than 16776 seconds, and works
01-26 13:02:14.277 RtmpProtocol:891 [ID-007] Seeking to 1594380
...
01-26 13:02:14.279 FileReaderWav:194 [ID-007] <Stream0001> Seeking to 15943804 sf_seek 127550432
...
01-26 13:02:16.250 FileReaderWav:230 [ID-007] <Stream0001> Current position: 15943824
// This is when it plays from the beginning (seeking after 16776 seconds)
// according to the log it should just play at the desired position, but it's not
01-26 13:02:23.294 RtmpProtocol:891 [ID-007] Seeking to 16990012
01-26 13:02:23.303 FileReaderWav:194 [ID-007] <Stream0001> Seeking to 16990012 sf_seek 135920096
01-26 13:02:23.463 FileReaderWav:230 [ID-007] <Stream0001> Current position: 16990032
We migth have a problem in the stream server, some INTEGER casting or something like that. I will update if I get more info.
Thank you