1

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

Radu Maris
  • 5,648
  • 4
  • 39
  • 54
  • Theres nothing in the docs to suggest 17000+ is not an acceptable value and there are no bugs logged for NetStream.seek(). Perhaps you've discovered a new one? I doubt many users have tried to play such long files before –  Jan 23 '13 at 15:15
  • @LeeBurrows There are any ways I can fill in a bug ? AFAIK flash is more or less dead from a development point of view, but nevertheless I think should let them know. – Radu Maris Jan 28 '13 at 13:48
  • bugs can be filed here: https://bugs.adobe.com/. And Flash certainly isnt dead; Flash websites maybe, but not flash itself –  Jan 28 '13 at 19:38

1 Answers1

2

I think you have to consider if the file is fully buffered to the desired seek position. If you are trying to STREAM a file (aka not fully loaded) and seek to a position of the file thats not fully loaded... it will generate an error, or just not go there.

SOLUTIONS:

(1) ensure the file is buffered to that position before seeking

(2) use PHP (or any server side) to serve you the file AT the desired point. This will save you tones on bandwidth as only the requested data will be passed.

Eg. If you're requested file is 1500mb, but you only need 800-1500mb... then serve the file at the position.

Reshape Media
  • 341
  • 3
  • 11
  • I generated a 1.1 Mb ogg file, that easily fits in the buffer, and I have the same problem at the exact same second. I tend to believe that it's a bug in NetStream, that won't be fixed taking in consideration that flash is more or less dead. – Radu Maris Jan 28 '13 at 11:36
  • @RaduMaris Flash is far from dead, I'm not sure about the update procedure with Apache, but I'm sure they are quite capable of dealing with issues/updates. To your question, it could very well be a bug. Personally I tend to split files and serve chunks (to save bandwidth) so I have not come across this. But I will test this tonight and let you know my findings. Also try [inBufferSeek], its a method of NetStream which should tell you if the data is buffered for "smart" stream (http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html) – Reshape Media Jan 28 '13 at 20:27
  • I have an error trying inBufferSeek "Error: Access of possibly undefined property inBufferSeek through a reference with static type flash.net:NetStream". I updated the code to see where and how the netStream is defined. Disclaimer: I did not build the player and it's my first time I am using flash :) – Radu Maris Jan 29 '13 at 12:12
  • @RaduMaris what sdk version are you using? – Reshape Media Jan 29 '13 at 14:16
  • None. I am using a simple text editor, and the compile is done with ant, mxmlc using Flex 3.4 on a Ubuntu Server 10.04 LTS. I am checking the stream server now. See updated question. – Radu Maris Jan 30 '13 at 10:45
  • Ahh... therein lies some of your problems. 3.4 is a really old SDK - with its own problems. You can still use Flex, but I suggest you download the most recent SDK from Adobe (4.6) or Apache (4.9). Updat the Flex SDK base and you will now have access to "extra" classes, methods/properties. After you do this, let me know the outcome. Main reason is, many classes have changed between 3.4 and 4.6 - MANY. – Reshape Media Jan 30 '13 at 21:20
  • I will discuss the update with my team, and I will let you know of the outcome, it can take a few days/weeks. For now I will close the question and I will drop you a comment if I will have new info. Thank you for all. – Radu Maris Jan 31 '13 at 10:24
  • @RaduMaris no problem. Just send me a comment. Cheers. – Reshape Media Jan 31 '13 at 18:02