Merge remote-tracking branch 'cadecairos/t560' into develop

This commit is contained in:
Jon Buckley 2011-06-20 16:49:24 -04:00
Родитель bab56dec98 138e29d10e
Коммит 3c5727f9c8
4 изменённых файлов: 47 добавлений и 6 удалений

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

@ -22,7 +22,7 @@
var paused = true,
popcorn;
popcorn = Popcorn( Popcorn.youtube( 'video', 'http://www.youtube.com/watch?v=9oar9glUCL0', { width: 400 } ) );
popcorn = Popcorn( Popcorn.youtube( 'video', 'http://www.youtube.com/watch?v=9oar9glUCL0', { width: 400, controls: 0, annotations: 3 } ) );
popcorn = popcorn
.footnote({
@ -102,7 +102,7 @@
paused = true;
element( 'btn-play-pause' ).innerHTML = 'Play';
})
.mute()
popcorn.mute()
.play();
// Setup UI after loaded

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

@ -120,13 +120,17 @@ var onYouTubePlayerReady;
this.offsetParent = container.offsetParent;
flashvars = {
playerapiid: this.playerId
playerapiid: this.playerId,
controls: this.controls,
iv_load_policy: this.iv_load_policy
};
params = {
allowscriptaccess: 'always',
allowfullscreen: 'true',
// This is so we can overlay html on top of Flash
wmode: 'transparent'
};
attributes = {
@ -182,6 +186,12 @@ var onYouTubePlayerReady;
options.width = options.width && (+options.width)+"px";
options.height = options.height && (+options.height)+"px";
// show controls on video. Integer value - 1 is for show, 0 is for hide
this.controls = +options.controls === 0 || +options.controls === 1 ? options.controls : 1;
// show video annotations, 1 is show, 3 is hide
this.iv_load_policy = +options.annotations === 1 || +options.annotations === 3 ? options.annotations : 1;
this._target = document.getElementById( elementId );
this._container = document.createElement( "div" );
this._container.id = this.playerId;

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

@ -28,6 +28,9 @@
Therefore, if failures occur for the first time, just run it again. Likely,
failures would disappear the second time.
</p>
<p>
There will be two separate youtube videos visible after the completion of these tests.
</p>
<div id="video" style="width: 360px; height: 300px" ></div>
<div id="video2" style="width: 360px; height: 300px" ></div>
<div id="video3" style="width: 360px; height: 300px" ></div>

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

@ -1,6 +1,4 @@
test( "Popcorn YouTube Plugin Event Tests", function() {
var popcorn = Popcorn( Popcorn.youtube( 'video', "http://www.youtube.com/e/ac7KhViaVqc" ) );
function plus(){
if ( ++count == expects ) {
@ -27,7 +25,8 @@ test( "Popcorn YouTube Plugin Event Tests", function() {
'ended'
];
var count = 0,
var popcorn = Popcorn( Popcorn.youtube( 'video', "http://www.youtube.com/e/ac7KhViaVqc" ) ),
count = 0,
eventCount = 0,
added = [],
set1Executed = false,
@ -238,3 +237,32 @@ test( "Popcorn YouTube Plugin Url Regex Test", function() {
start();
});
test( "Controls and Annotations toggling", function() {
QUnit.reset();
expect( 6 );
var popcorn = Popcorn( Popcorn.youtube( "video", "http://www.youtube.com/watch?v=9oar9glUCL0" ) ),
targetDiv = document.getElementById( "video" );
testTarget = targetDiv.querySelector( "object" ).querySelector( "param:nth-of-type( 4 )" );
ok( /controls=1/.test( testTarget.value ), "controls are defaulted to 1 ( displayed )" );
ok( /iv_load_policy=1/.test( testTarget.value ), "annotations ( iv_load_policy ) are defaulted to ( enabled )" );
targetDiv.innerHTML = "";
popcorn = Popcorn( Popcorn.youtube( "video", "http://www.youtube.com/watch?v=9oar9glUCL0", { controls: 1, annotations: 1 } ) );
testTarget = targetDiv.querySelector( "object" ).querySelector( "param:nth-of-type( 4 )" );
ok( /controls=1/.test( testTarget.value ), "controls is set to 1 ( displayed )" );
ok( /iv_load_policy=1/.test( testTarget.value ), "annotations ( iv_load_policy ) is set to 1 ( enabled )" );
targetDiv.innerHTML = "";
popcorn = Popcorn( Popcorn.youtube( "video", "http://www.youtube.com/watch?v=9oar9glUCL0", { controls: 0, annotations: 3 } ) );
testTarget = targetDiv.querySelector( "object" ).querySelector( "param:nth-of-type( 4 )" );
ok( /controls=0/.test( testTarget.value ), "controls is set to 0 ( hidden )" );
ok( /iv_load_policy=3/.test( testTarget.value ), "annotations ( iv_load_policy ) is set to 3 ( hidden )" );
});