Skip to content

Commit

Permalink
[#1166] Popcorn.smart vs query strings. Are we smart yet?
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottDowne committed Jun 20, 2012
1 parent f87c515 commit 44b7ee8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions modules/player/popcorn.player.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
videoExtensions = "ogg|ogv|mp4|webm",
mediaExtensions = audioExtensions + "|" + videoExtensions;

var audioExtensionRegexp = new RegExp( "^.*\\.(" + audioExtensions + ")$" ),
mediaExtensionRegexp = new RegExp( "^.*\\.(" + mediaExtensions + ")$" );
var audioExtensionRegexp = new RegExp( "^.*\\.(" + audioExtensions + ")($|\\?)" ),
mediaExtensionRegexp = new RegExp( "^.*\\.(" + mediaExtensions + ")($|\\?)" );

Popcorn.player = function( name, player ) {

Expand Down
1 change: 1 addition & 0 deletions modules/player/popcorn.player.unit.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ <h2 id="qunit-userAgent"></h2>
<div id="multi-div-mixed3"></div>
<div id="multi-div-mixed4"></div>
<div id="multi-div-mixed5"></div>
<div id="multi-div-mixed6"></div>
<video id="multi-video" controls></video>
<audio id="multi-audio" controls></audio>
<video id="multi-video2" controls></video>
Expand Down
11 changes: 9 additions & 2 deletions modules/player/popcorn.player.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,16 +359,20 @@ asyncTest( "Popcorn.smart - multiple sources for mixed media", function() {
}
});

expect( 5 );
expect( 6 );

var p1, p2, p3, p4, p5,
var p1, p2, p3, p4, p5, p6,
srcResult;

p1 = Popcorn.smart( "#multi-div-mixed1", [ "invalid", "../../test/trailer.ogv", "playerOne" ] );
p2 = Popcorn.smart( "#multi-div-mixed2", [ "playerOne", "../../test/trailer.ogv", "playerTwo" ] );
p3 = Popcorn.smart( "#multi-div-mixed3", "playerTwo" );
p4 = Popcorn.smart( "#multi-div-mixed4", [ "invalid", "playerTwo", "../../test/trailer.ogv" ] );
p5 = Popcorn.smart( "#multi-div-mixed5", "../../test/trailer.ogv" );
p6 = Popcorn.smart( "#multi-div-mixed6",
[ "../../test/trailer.derp?smartnotsosmart=no",
"../../test/trailer.ogv?arewesmartyet=yes",
"../../test/trailer.derp?smartnotsosmart=no" ] );

srcResult = p1.media.src.split( "/" );
equal( p1.media.src.split( "/" )[ srcResult.length - 1 ], "trailer.ogv", "HTML5 works as valid fallback." );
Expand All @@ -385,5 +389,8 @@ asyncTest( "Popcorn.smart - multiple sources for mixed media", function() {
srcResult = p5.media.src.split( "/" );
equal( p5.media.src.split( "/" )[ srcResult.length - 1 ], "trailer.ogv", "HTML5 works as first media, even if it is the only media." );

srcResult = p6.media.src.split( "/" );
equal( p6.media.src.split( "/" )[ srcResult.length - 1 ], "trailer.ogv?arewesmartyet=yes", "HTML5 works as second valid media, even if it has a query string." );

start();
});

0 comments on commit 44b7ee8

Please sign in to comment.