Merge RTMP and other changes #77

wants to merge 52 commits into

3 participants


Hi Mark - just popping in the pul request for whenever you get a chance to take a deeper look - all the best!

rmhall added some commits Jul 12, 2011
@rmhall rmhall Initial commit adding rtmp support
Basic support for rtmp, more advanced features coming later. Primary changes are in Flash/ActionScript, including a new class, modifications to and minor change in jquery.jplayer.js to accomodate the new media type of "rtmp"
@rmhall rmhall Merged 2.0.25 changes and some rtmp bug fixes
Merged latest jquery.jplayer.js 2.0.25 changes, an updated compiled.swf, a few bug fixes in (extra logic checks to not clear NetConnection and NetStreams if not already created), and incorrect Mac CR line feeds in .as which don't display properly in GitHub - doh!
@rmhall rmhall Merge with master 2.0.28 changes to JS and 2.0.26 ActionScript changes
Merge of changes from 2.0.28 JavaScript and 2.0.26 ActionScript master.
Recompiled .swf, also merged in applicable changes from the that also applied to the custom (pause
issue, etc)
@rmhall rmhall RTMP fork notes
Contains some extra info and notes on this particular fork, its usage,
and a TODO list of extra features to be implemented in the future
@rmhall rmhall Backported jquery.jplayer.js to 2.0.21 and other bug fixes and enhanc…

Had to revere jquery.jplayer.js back to version based on 2.0.21 to fix
duration bugs, one of the latest master checkins of a newer version
appears to be causing problems with duration and currenttime updates,
need to dig into and find the cause. Also added more rtmp source parsing
robustness in, added some more details to the
RTMP_SUPPORT_README, and updated the other ActionScript files to the
latest 2.0.26 versions. Only the core jquery.jplayer.js is now out of
sync - hope to fix this soon and merge the latest changes and then issue
another Pull request, probably after 2.1 is released.
@rmhall rmhall Spelling error 9e10ed6
@rmhall rmhall Initial commit of in progress NetConnection manager class and better …
…rtmp url parsing

Added a support class for to handle the
negotiation of NetConnection's to FMS servers. Handles automatic
port/protocol negotiation for more robust performance and likelihood of
making connections, especially for users behind firewalls or in
enterprise environments where standard ports might be blocked. Also
improved the rtmp url parsing including support for custom FMS instance
names - see RTMP_SUPPORT_README for more information and usage.
@rmhall rmhall Bug fixes related to NetConnection negotiation and streams
Added missing onFCUnsubscribe event to prevent errors when a live stream
is dropped Added checks to make sure any unconnected, but created
NetConnections during multi port/protocol negotiation are cleared, and
intervals are cleared before making connections new connection manager
attempts.  Started stubbing out support for checking to see if host,
server, appname, port, protocol are the same (just a new stream) and if
so, re-use existing NetConnection and return it instead of
re-negotiating a new connection - finish in next checkin.
@rmhall rmhall Added support for recycling existing rtmp NetConnection
If the hostname and appname of an rtmp source are the same, and only the
streamname has changed between requests, then recycle/use the existing
NetConnection instead of close/renegotiating it - much faster/less
overhead when just switching streams.
@rmhall rmhall Added status update about 2.1 94da976
@rmhall rmhall Merged jquery.jplayer.js version 2.1
Merged the most recent release of jqyer.jplayer.js 2.1 (dated 9/1/11)
with my changes to support rtmp streams
@rmhall rmhall New class for localConnection debugging
Added this class ( as a helper to handle custom
debugging/tracing of values via a custom Adobe AIR app (to be committed
@rmhall rmhall Most recent published .swf
This is the latest, but it has some temporary customizations, probably
not best for production use, wait for a new build to be committed -
this is just a byproduct of needing to commit all my recent changes...
@rmhall rmhall Several changes since last version
Kind of in flux at the moment, many of the debug events are turned off,
and logging is disabled (troubleshooting some edge issues with LIVE
rtmp streams and JS implementation to isolate some potential high
utilization issues).
Does contain some fixes to make sure LIVE streams have the proper
bufferTime and bufferTimeMax to prevent glitches in LIVE streams also
sets pre-recorded/on-demand streams to proper bufferTime/bufferTimeMax
Also a few fixes in the connectionManager implementation, and a few
other fixes in general.
@rmhall rmhall Fixes for rapid successive setMedia requests
Add some workarounds (possibly a little kludgy) so that if setMedia is
called in rapid succession while the player is currently playing,
ConnectionManager can properly shut things down and handle closed
connections, and short-circuit any active connection attempts (what a
pain!) and edge case, but easy to run into.
@rmhall rmhall Fixes for rapid successive setMedia and new logging
Add some workarounds (possibly a little kludgy) so that if setMedia is
called in rapid succession while the player is currently playing,
ConnectionManager can properly shut things down and handle closed
connections, and short-circuit any active connection attempts (what a
pain!) and edge case, but easy to run into.

Also added in support for a new external helper AIR app (to be
committed soon) to watch/save debug and log output. Right now much of
the logging and debug events are disabled temporarily while
troubleshooting another potential glitch with LIVE rtmp streams.

Also, this version still reports older values, so jquery.jplayer.js in
the last commit looks for these older versions of the player, and not
the most recent versions. Will sync/update the AS version #'s reported
to match the latest master 2.1 release in the next commit or two...
@rmhall rmhall Edited RTMP_SUPPORT_README via GitHub e1cbcb7
@rmhall rmhall Edited RTMP_SUPPORT_README via GitHub e7d32be
@rmhall rmhall Renamed original README and swapped RTMP_SUPPORT_README to README
Swapped the files around so that this fork called out the changes more
directly if browsing via GITHUB
@rmhall rmhall Moved the notes about RTMP fork changes to this file from the README 289d5d9
@rmhall rmhall Edited README via GitHub 677c7f4
@rmhall rmhall Updates on history, changes, and RTMP_NOTE doc 77c49b1
@rmhall rmhall Added in history for initial commit on July 12th 61b1a04
@rmhall rmhall Edited README via GitHub 0a1f796
@rmhall rmhall First commit of skin and add-on folders/contents from master repo
No changes, just adding in these items from the master 2.1 repo
@rmhall rmhall Edited README via GitHub 2784600
@rmhall rmhall Latest commit, now fully synced with master 2.1 release
LIVE streaming bug fixed, and now synced across the board with master
2.1 repository - yay! Now only new features and custom logging remains
to be completed along with testing of video and existing mp3/mp4
@rmhall rmhall Updated read me to reflect latest status 677ff95
@rmhall rmhall Fix bug related to duration and current time
2.1 version of jquery.jplayer.js changed a few behaviors, and this
caused a problem where the time updates for the progress bar and
current time weren't getting updated after a second setMedia request.
This was related to the dispatched events of the status of the player.
Now fixed.
@rmhall rmhall Buffering changes for LIVE mp3/aac rtmp streams
Optimal buffering settings for LIVE mp3/aac rtmp streams. See notes
about NellyMoser or Speex codec LIVE usage.
@rmhall rmhall Added link to master on github of Happyworms source (should have been…
… in there from beginning - doh!)
@rmhall rmhall Fix for restart on Idle and injections preventing pause, setMedia
Fixes issue where streams paused for an hour (3600) and get net
connection timeout, were auto-restarting because of code to handle the
closing of net connections and re-connection attempts on multiple rapid
setMedia requests. Was also preventing resume from pauses due to the 0
length duration of live rtmp streams.
@rmhall rmhall Updated README with latest version history changes 6bb5db6
@rmhall rmhall Another minor fix related to idle timeouts ed59a35
@rmhall rmhall Added dual threshold buffering support and changed bufferTime and buf…
…ferTimeMax values
@rmhall rmhall Bug fix related to dual threshold buffering, adjusted values and remo…
…ved for LIVE rtmp streams.
@rmhall rmhall Fixed case statement switch for rtmpv - was in wrong area preventing …
…video from working

Video now works, but sizing needs to be support by extracting metadata
in proper fashion to determine and set width/height.
@rmhall rmhall Change to make sure video is resized properly - video is now function…
…ing with RTMP!
@rmhall rmhall Video sizing tweak and updated README and RTMP_NOTES 0aa0f18
@rmhall rmhall UPDATED README 1b5548e
@rmhall rmhall Update README 4c72990
@rmhall rmhall Update RTMP_NOTES 7e40ac2
@rmhall rmhall Updated version date b915a43
@rmhall rmhall Added reference to see things in action at eef5aee
@rmhall rmhall Update RTMP_NOTES 6b3ce07
@rmhall rmhall Update RTMP_NOTES c47e5b2
@rmhall rmhall Update README 226b17b

Added example link and info...


Hi Robert. I have incorporated your RTMP support into jPlayer. I could not merge your changes due to many conflicts. While I could have dealt with those in the file, where most of them were, the merge also flagged conflicts with images and other items that should have been identical. EG. The images in the CSS.

I have a working demo of your Space Alone demo at:

Everything appears to be working fine with the changes, however I have noticed a few issues with your event generation. Such as timeupdate and progress events always running... And the pause/stop command triggering loadstart and the paused event (regardless of play state).

I suggest that we/you can review these once I have pushed this version to GitHub. I'm not sure how you will work with your fork afterwards... I did tweak your code a little, but it was only to remove unused vars and combined the logging system. You seemed to disable it all via commenting out. There is a debug property to turn all that on and off. And you have some readme files in your fork that might get removed on a merge.

Other than that, the Flex compiler throws many warnings about var declaration in that ConnectManager class and in a few other places.

Do you think they matter?

I thought those type of warnings indicate the compiler cannot function at maximum optimization, leading to larger compile times and a larger SWF file... As the compiler falls back to different compiler. Compile time don't matter really, but the SWF file should be optimum size.

Your thoughts on that last part, as I may well be wrong... And 14kB seems fine for the Flash... Even if it did grow by 55% from 9kB.


NB: I only really tweaked the code.

I used the jPlayer 2.1.0 happyworm package files... And added in your 3 new classes. (Unchanged)


Hi Mark, thanks for the update. Sorry it was such a hassle to incorporate all the changes. Not sure why the images and other items from the example files were not identical, but sounds like you worked that out.

The link you posted was a link back to my site - did you mean to post a link somewhere on yours for me to take a look?

I'd be happy to take a look at the event stuff you noted when I can see a link or get the new combined code base. Happy to review things, I can always start a new fork or figure something out.

Yes the debugging, I had started an entirely separate AIR app that floats above all your other windows, and would capture stuff in realtime so you could see all the events, and extra information about the RTMP streaming netstatus event info, but I didn't get a chance to push it into my fork yet. It comes in really handy for working with clients, as its a simple app they can just launch, hit capture and then it grabs everything and with one button will copy or email it for you.

No worries about the read me files, happy to figure out best way to document the RTMP stuff with you.

If you happened to keep around a copy of the output from the Flex compiler I'd be happy to take a look - I should go ahead and get it setup in Flex too and take a look on my end - just been using the Flash IDE to compile - if they are warnings, then its more than likely OK - errors though of course need to be looked at, but I'm sure I could fix the source of the warnings as well once I see what they are.

In terms of size - that actually sounds about right, when I compile on my end, its 13,614bytes - and when I do a decompile via some tools - there is no extra byte code or cruft, its just a bit bigger due to the additional class file and other ActionScript items. In any case though, happy to double check those warnings, and look into the events stuff.

Whenever you can provide a copy of the new merged source (a new private branch, an offline .zip, whatever is easiest) I'd be happy to take the SWF and put it through some of my tests on my end, and check everything out.

Thanks Mark!


I plan to put this demo up later. It is just the demo-01-video-supplied-mv4 one with the rtmp url copied in. (Ok. And set the supplied option to rtmpv and I copied your poster to

I saw the event issues immediately via the jPlayer inspector.

The expanded logging for Air can be added in due course. I had in the past considered expanding it so that there is a 'log' event and then it could be displayed via JS on the page for other browsers. And enable the debug option in the jPlayer options, so we can cut that junk out for normal operation. Like how I had done it, just change where that debug variable comes from. Anywayz... Tangent.

I looked into making public branches. It is so easy that I did not believe the code when i saw it and assumed i was missing something. 'git push origin <new remote branch>' However, I am not sure if we need one. I tagged the minor 2.0.0 and 2.1.0 releases... And I'll tag the next stable official release too.

I'll try and get this online tonight. If not, tomorrow.


Gotcha - thanks for all the extra info Mark. Sounds good on everything - if you need anything at all in the meantime, please ping me. Will keep an eye out for when it goes up, and look into everything - thanks!


I'll push to github soon...

Here is the demo:
And all the other demos should be up here too:
NB: It is easy to fall back into the /latest/ release if you are not careful, which is 2.1.0.

Release notes:

On the RTMP demo, open up the inspector. The progress event seems to always fire... The timeupdate event fires correctly until it gets to the end or if you stop, after which it keeps going even if you pause again. The loadstart event fires after ending and when stop used.

That is the brief summary. I might have missed something there as it is getting late.


Hi Mark - great, I see the push is up - will take a look at things this morning and start testing and get you some feedback. Thanks!


Oops - see the site is down for DNS migration, will have to check the release notes and other items once thats back up.

One thing I did quickly notice just now, and this happens a lot with ActionScript because of a bug in the AS editor, the raw files on github have Mac style line endings, specifically,, and - they just need to be reserved with unix style linefeeds, and then they will fully show up when viewed in github in raw mode. Just an annoyance more than anything. I'm downloading and compiling things on my end and will start digging in. Thanks!


Quick update for you - a download and compile on my end and dropping it into my test suite for the site I originally did all the changes for and everything checks out. I'll double check on all the event stuff today and get back to you to see what I might need to adjust. One question about that- were you only seeing the weird events when using rtmp sources? Or was it also showing in the other standard sources you had built in already?

Also, as an option for folks who really want so shave a couple extra Kb off the player size, Flash 11+ supports LZMA compression on the SWF itself, in a test of mine, that drops 2Kb off the size getting it down to 11Kb - there is a separate standalone utility for converting a .swf from .gzip compression to .lzma - I can document all this as a tip for folks.

I'm going to get Flex setup to compile this next and see what it is complaint about on the class, and even with all warnings for AS3 and other items turned on in the Flash IDE, it has no complaints compiling, etc. so I'm curious to see what the warnings are that Flash Builder is giving. FYI, I'll be using the latest mxmlc compiler from Flash Builder 4.6 when I test, as I noticed you are using 4.5.1 build 21328. Will let you know what all I see.

Thanks again Mark!


Hi Mark - one more quick update on the warnings from Flex mxmlc - I see them now, just tried compiling, and its throwing warnings about many of the variables in and missing type declarations - that's a really simple fix - I meant to go back and do that at some point. This explains why the IDE wasn't complaining, but mxmlx was, since its stricter about those types of warnings. I'll put in the proper types on all the vars and push up a new version of each on my fork, and let you know when they are up so you can integrate back in - that will get rid of the warnings when compiling with mxmlc. Then its just tracking down the event issues you noted. Thanks!


Another quick update for you - eliminated all the Flex mxmlc warnings - they were pretty much all type declarations for variables or return types on functions, all minor stuff - there were some of these issues that needed to be changed in and as well. I fixed them all and mxmlc no longer throws any warnings on compile. I'll get these up for you in just a little bit.


I'll try and catch up...

Yes. is down cause we forgot to renew the domain name. <blush> It should burst into life in a few hours.

I noticed that issue with the Mac versus Windows files. My editor said all your files were mac encoded. Well I think it was saying that when looking at the saveAs options and what there were already set at. I need to look at what you mean though.

I only noticed problems with your RTMP events. I did check the other demos worked with the new JS and SWF and I found no issues. Least not during the usual checks i make.

The flash checker in jPlayer requires a review... Flash 11 does not work with the checker... As in you cannot check for it. Least on Windows IE. I plan to review that part. Technically jPlayer requires Flash 10.1, but only checks for 10. We should check for 10.3 to avoid a bunch of problems with VBR MP3 files and GZIPed media. So want a nice concise way to solve that problem first before we consider any of these Flash 11 possibilities.

Yes, I plan to update to the latest Flex version in due course.

Yeah, I figured Flex was being strict. And that all we need to do is add in the type. I did try and solve the type warning in The resizing bit, where the var is set to either RTMP or MP4 player, but it did not like me using the Sprite class which they inherit from. I think we need an interface for all the players and then the var can use that interface as type.

I'm working on something else today... I hope to return to jPlayer again tomorrow. There are some other pull requests like the DRY commands i want to pull in.



Post crossover.

Cool on fixing all the warning.


Hi Mark - I DM'd you a link on twitter to the fixed ActionScript code that fixes all the warnings that mxml was throwing - fixes all the type declarations for variables a few function returns, and also fixed the line ending issues on a few files that were still set to Mac instead of Linux. I fixed the issue with the one warning on the videoItem for RTMP or MP4 by using the :* type :) Let me know if you need anything else. I see the site is backup - so will take a look around a little later today. Thanks!

rmhall added some commits Apr 13, 2012
@rmhall rmhall RTMP Features now in main master branch of Jplayer project! Merged ba…
…ck into this fork - see details!

Also incorporated new security fix from 2.1.2 and fixed some missing
type declarations, so no more warnings when compiling from mxmlc,
better coding practice too. The best thing is though, that RTMP
features are now in the main project repository. :) Keeping this fork
open for additional work/customizations, etc.
@rmhall rmhall Updated SWF - version 2.1.2 based on all recent changes 9038cba
@rmhall rmhall Syncing from main repo - no real differences - doing this for easier …
…pull request completion….
@rmhall rmhall Update README 46f64d8

Closing this PR as it has now been incorporated into jPlayer.

@happyworm happyworm closed this Oct 9, 2012
Happyworm Ltd member

Hello @rmhall would you please sign our CLA

I notice that you do not come up under the contributor list for jPlayer, which is a shame since you contributed a large chunk. Maybe we can fix that with some arbitrary PR in the AS code for the RTMP player. Ideally a fix of some kind.


Happyworm Ltd member

Hello @rmhall would you please sign our CLA

I do not want to have to remove the RTMP player from jPlayer's Flash, but will have to unless you agree to the CLA. Please let me know if there is a problem.

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