Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update JplayerRtmp.as #161

Closed
wants to merge 1 commit into from

4 participants

@iking0980

Fix problem with connection Amazon cloudfront signeture url

@iking0980 iking0980 Update JplayerRtmp.as
Fix problem with connection Amazon cloudfront signeture url
526da54
@happyworm

The RTMP part was @rmhall baby.
Could you eyeball this PR Robert and give a nod if it should be merged.

Ideally if you or @iking0980 could provide an example RTMP url for an Amazon cloudfront signature... Then I/we can review and test it.

@rmhall

This appears to be correct based on the additional information that can be passed in as url query params for Amazon CloudFront rtmp connection strings, like this example: rtmp://s3example.cloudfront.net/cfx/st/mp4:path_to_file/more_path/my_file.mp4?Expires=xxxxxxxxx&Signature=xxxxxxxxx&Key-Pair-Id=xxxxxxxxxx&Policy=xxxxxxxxxxxx

Offhand, I don't believe it should cause any problems for other implementations that also pass in additional params, should help there as well.

Not to be nitpicky, but purely for formatting consistency and readability, I'd make sure the else statement on lines 521 and 536 wraps braces around the following streamFileName = … statements.

The code does not work with the existing RTMP demo.

Investigating, the 2 lines like this look incorrect:

if ( streamFileName.indexOf("?") )

Failing to find the ? will return -1, which is truethy. So it worked fine in @iking0980 case, which would have had the ? somewhere in the url, but fails with our original RTMP url.

@happyworm

Nit pick away. I always add the curlies too :+1:
It is one of the recommended coding styles for Open Source projects.

Thank you for the feedback @rmhall - I plan to integrate this into the dev branch next.

@happyworm

While I'm in this part of the code... I also noticed this:

if (rtmpSrc.indexOf(".mp3") != -1) {
   appName = rtmpSrc.substring(endHost,rtmpSrc.indexOf("mp3:"));

Shouldn't they both be "mp3:" @rmhall?
BTW, this code was not part of the PR commit.

@happyworm

Code merged into the dev branch.

Release note:
[dev] Added Support: The Flash RTMP player now supports an Amazon CloudFront Signature URL. This addition was proposed here Update JplayerRtmp.as by iking0980.

Cheers to all involved in this change.

@happyworm happyworm closed this
@thepag
Owner

Hello @iking0980 would you please sign our CLA

Cheers!

@thepag
Owner

Hello @iking0980
Please sign the CLA

If you do not want to sign it, then please contact me and we can remove your contribution from the project.

@thepag
Owner

Cheers @iking0980

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 10, 2013
  1. @iking0980

    Update JplayerRtmp.as

    iking0980 authored
    Fix problem with connection Amazon cloudfront signeture url
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 3 deletions.
  1. +15 −3 actionscript/happyworm/jPlayer/JplayerRtmp.as
View
18 actionscript/happyworm/jPlayer/JplayerRtmp.as
@@ -513,7 +513,13 @@ package happyworm.jPlayer
{
appName = rtmpSrc.substring(endHost,rtmpSrc.indexOf("mp3:"));
streamFileName = rtmpSrc.substr(rtmpSrc.indexOf("mp3:"));
- streamFileName = streamFileName.substr(0,streamFileName.length - 4);
+ if ( streamFileName.indexOf("?") )
+ {
+ var tmp:String = streamFileName.substring(streamFileName.indexOf("?")) ;
+ streamFileName = streamFileName.substr(0,streamFileName.indexOf("?")) + encodeURI(tmp) ;
+ }
+ else
+ streamFileName = streamFileName.substr(0,streamFileName.length - 4);
}
// rtmp://cp83813.edgefcs.net/ondemand/rob_hall/bruce_campbell_oldspice.flv
@@ -522,7 +528,13 @@ package happyworm.jPlayer
{
appName = rtmpSrc.substring(endHost,rtmpSrc.indexOf("mp4:"));
streamFileName = rtmpSrc.substr(rtmpSrc.indexOf("mp4:"));
- streamFileName = streamFileName.substr(0,streamFileName.length - 4);
+ if ( streamFileName.indexOf("?") )
+ {
+ var tmpV:String = streamFileName.substring(streamFileName.indexOf("?")) ;
+ streamFileName = streamFileName.substr(0,streamFileName.indexOf("?")) + encodeURI(tmpV) ;
+ }
+ else
+ streamFileName = streamFileName.substr(0,streamFileName.length - 4);
}
// .f4v streams with standard appname/no instance name, .flv extension
@@ -981,4 +993,4 @@ package happyworm.jPlayer
}
}
}
-}
+}
Something went wrong with that request. Please try again.