Merge pull request #111 from ScottDowne/t1166

T1166
This commit is contained in:
Jon Buckley 2012-06-20 11:57:16 -07:00
Родитель 84fdf643dd d31520db16
Коммит 5ea8870c46
4 изменённых файлов: 35 добавлений и 4 удалений

Просмотреть файл

@ -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 ) {

Просмотреть файл

@ -27,6 +27,9 @@
<div id="multi-div-mixed3"></div>
<div id="multi-div-mixed4"></div>
<div id="multi-div-mixed5"></div>
<div id="multi-div-mixed6"></div>
<div id="multi-div-mixed7"></div>
<div id="multi-div-mixed8"></div>
<video id="multi-video" controls></video>
<audio id="multi-audio" controls></audio>
<video id="multi-video2" controls></video>

Просмотреть файл

@ -359,9 +359,9 @@ asyncTest( "Popcorn.smart - multiple sources for mixed media", function() {
}
});
expect( 5 );
expect( 8 );
var p1, p2, p3, p4, p5,
var p1, p2, p3, p4, p5, p6, p7, p8,
srcResult;
p1 = Popcorn.smart( "#multi-div-mixed1", [ "invalid", "../../test/trailer.ogv", "playerOne" ] );
@ -369,6 +369,18 @@ asyncTest( "Popcorn.smart - multiple sources for mixed media", function() {
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" ] );
p7 = Popcorn.smart( "#multi-div-mixed7",
[ "http://usr:pwd@www.test.com:81/dir/dir.2/video.derp?q1=0&&test1&test2=value#top",
"http://usr:pwd@www.test.com:81/dir/dir.2/video.ogv?q1=0&&test1&test2=value#top",
"http://usr:pwd@www.test.com:81/dir/dir.2/video.derp?q1=0&&test1&test2=value#top" ] );
p8 = Popcorn.smart( "#multi-div-mixed8",
[ "host.com:81/direc.tory/file.derp?query=1&test=2#anchor",
"host.com:81/direc.tory/file.webm?query=1&test=2#anchor",
"host.com:81/direc.tory/file.derp?query=1&test=2#anchor" ] );
srcResult = p1.media.src.split( "/" );
equal( p1.media.src.split( "/" )[ srcResult.length - 1 ], "trailer.ogv", "HTML5 works as valid fallback." );
@ -385,5 +397,12 @@ 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." );
equal( p7.media.src, "http://usr:pwd@www.test.com:81/dir/dir.2/video.ogv?q1=0&&test1&test2=value#top", "HTML5 works as second valid media, even if it has a query string." );
equal( p8.media.src, "host.com:81/direc.tory/file.webm?query=1&test=2#anchor", "HTML5 works as second valid media, even if it has a query string." );
start();
});

Просмотреть файл

@ -655,3 +655,12 @@ asyncTest( "youtube player quarantine", function() {
start();
});
asyncTest( "youtube can play type", function() {
ok( Popcorn.youtube.canPlayType( "div", "http://youtube.com/watch/v/6v3jsVivU6U?format=json" ), "youtube can play url in this format: http://youtube.com/watch/v/6v3jsVivU6U?format=json" );
ok( Popcorn.youtube.canPlayType( "div", "http://www.youtube.com/v/M3r2XDceM6A&amp;fs=1" ), "youtube can play url in this format: http://www.youtube.com/v/M3r2XDceM6A&amp;fs=1" );
ok( Popcorn.youtube.canPlayType( "div", "youtube.com/v/M3r2XDceM6A&fs=1" ), "youtube can play url in this format: youtube.com/v/M3r2XDceM6A&fs=1" );
ok( Popcorn.youtube.canPlayType( "div", "www.youtube.com/v/M3r2XDceM6A&amp;fs=1" ), "youtube can play url in this format: www.youtube.com/v/M3r2XDceM6A&amp;fs=1" );
start();
});