Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update JplayerRtmp.as

Fix problem with connection Amazon cloudfront signeture url
  • Loading branch information...
commit 526da543798fdd982da4085483019e7945391fcb 1 parent c1c7a4d
@iking0980 authored
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
}
}
}
-}
+}

2 comments on commit 526da54

@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.

@happyworm

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.

Please sign in to comment.
Something went wrong with that request. Please try again.