Skip to content

Commit

Permalink
Fixed logic errors in #161 and cleaned code styling.
Browse files Browse the repository at this point in the history
  • Loading branch information
thepag committed Nov 3, 2013
1 parent e4a6c5d commit 5ca8187
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions actionscript/happyworm/jPlayer/JplayerRtmp.as
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* http://opensource.org/licenses/MIT
*
* Author: Robert M. Hall
* Date: 29th January 2013
* Date: 3rd November 2013
* Based on JplayerMp4.as with modifications for rtmp
*/

Expand Down Expand Up @@ -508,32 +508,28 @@ package happyworm.jPlayer
}

// Mp3 streams with standard appname/no instance name, mp3: prefix
if (rtmpSrc.indexOf(".mp3") != -1)
{
if (rtmpSrc.indexOf("mp3:") != -1) {
appName = rtmpSrc.substring(endHost,rtmpSrc.indexOf("mp3:"));
streamFileName = rtmpSrc.substr(rtmpSrc.indexOf("mp3:"));
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);
if ( streamFileName.indexOf("?") != -1 ) {
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

// Mp4 streams with standard appname/no instance name, mp4: prefix
if (rtmpSrc.indexOf("mp4:") != -1)
{
if (rtmpSrc.indexOf("mp4:") != -1) {
appName = rtmpSrc.substring(endHost,rtmpSrc.indexOf("mp4:"));
streamFileName = rtmpSrc.substr(rtmpSrc.indexOf("mp4:"));
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);
if ( streamFileName.indexOf("?") != -1 ) {
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
Expand Down Expand Up @@ -992,4 +988,4 @@ package happyworm.jPlayer
}
}
}
}
}
Binary file modified jquery.jplayer/Jplayer.swf
Binary file not shown.

2 comments on commit 5ca8187

@rmhall
Copy link

@rmhall rmhall commented on 5ca8187 Nov 3, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks better, and correct, just needed the != -1 for the streamFileName.indexOf("?"); Sorry didn't catch that on my first review - was just eyeballing it and missed that.

@happyworm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hehe - I missed it too until I tried the demo with the new SWF and it didn't work.

Am I correct in changing line 511 to use "mp3:"?
I suppose it makes no difference, but it lines up with the mp4 code then and also you have the logic and the string manipulation checking for the same thing.

Please sign in to comment.