Ticket #230 (closed bug: fixed)
rtmp mp3 length: load with getStreamLength?
| Reported by: | jeroen | Owned by: | |
|---|---|---|---|
| Priority: | Milestone: | Flash 4.2 | |
| Component: | Keywords: | ||
| Cc: | Forum thread: |
Description
Jeroen:
I'm just pointing out that the example you linked to at: http://www.jeroenwijering.com/?page=test&example=115 is in fact using bunny.flv as its source file, which might explain why it's working for you and no one else. Try changing it from bunny.flv to bunny.mp3 and you will see the same error that everyone else is getting. The MP3 plays, but does not show a total time or allow you to scrub the timeline -- this is the case even on your example page.
I'm experiencing this error on my server as well, using FMS3 and streaming from VOD. FLV files work fine, but all of my MP3's do not.
I read a fix for JWFLV 3.1.6 and tried to port it over to version 4.0, but my AS3 skills are sorely lacking and my attempts accomplished absolutely nothing.
I'm venturing a guess that in the setStream() method in RTMPModel.as, getStreamLength() has to get called somehow, but I'm totally lost as to how to accomplish it.
Hope that helps you in your debugging... I, among many others, would love to get the streaming mp3 feature to work. Thanks for all the hard work.
Change History
comment:2 Changed 5 years ago by jeroen
- Milestone changed from Flash 4.2 to Flash 4.3
Adobe says this is how it should be done:
http://livedocs.adobe.com/flashmediaserver/3.0/hpdocs/help.html?content=00000078.html
Not working with the FMS3 server I tried...
comment:3 Changed 5 years ago by jeroen
- Status changed from new to closed
- Resolution set to fixed
- Milestone changed from Flash 4.3 to Flash 4.2
Fixed! The streamlength will now be called automatically, and the player will pick up the duration.
If you want to listen to this from actionscript / javascript, listen to the META event of the Model: META,{type:streamlength,duration:xxx} event.

I've hacked the code and got this working for FMS3 at least. I'm slightly amazed. All hail open source .... :)
Added code into the setStart() function of FLVModel.as as follows:
[quote] if (flvType=="RTMP" && feeder.feed[currentItem]id? != currentURL) { connectObject.connect(feeder.feed[currentItem]file?); currentURL = feeder.feed[currentItem]id?; setStreamObject(connectObject); streamObject.play(currentURL); /* added getStreamLength() call here / var ref = this; var resObj = new Object(); resObj.onResult = function (val:Number):Void { ref.feeder.feed[ref.currentItem]duration? = val; } connectObject.call("getStreamLength",resObj,currentURL); } quote
With this in place, MP3 streaming with scrubbing (and proper begin and end times) works like a charm.
This should work with FMS3, or any FMS2 app that defines a Client.prototype.getStreamLength() function. The FMS3 "vod" service does this for you thankfully.
Of course there's no error handler for when no getStreamLength function is defined, so it'll probably break for Red5.
Also I'd prefer the metadata to be used in preference, but I'm not sure how best to do this - suggestions welcome!