зеркало из https://github.com/mozilla/popcorn-js.git
Merge pull request #99 from secretrobotron/t1143
[t1143] text plugin target can be media element
This commit is contained in:
Коммит
5280e3e0e7
|
@ -68,6 +68,13 @@
|
|||
multiline: true
|
||||
})
|
||||
|
||||
// Overlay
|
||||
.text({
|
||||
start: 40,
|
||||
end: 45,
|
||||
text: 'Text on video'
|
||||
})
|
||||
|
||||
.play().volume( 0 );
|
||||
} );
|
||||
|
||||
|
|
|
@ -171,6 +171,9 @@
|
|||
if ( !target ) {
|
||||
target = createSubtitleContainer( this, options.target );
|
||||
}
|
||||
else if ( [ "VIDEO", "AUDIO" ].indexOf( target.nodeName ) > -1 ) {
|
||||
target = createSubtitleContainer( this, options.target + "-overlay" );
|
||||
}
|
||||
|
||||
} else if ( !this.container ) {
|
||||
// Creates a div for all subtitles to use
|
||||
|
|
|
@ -338,3 +338,25 @@ asyncTest( "Subtitle container creation tests", 3, function() {
|
|||
popped.destroy();
|
||||
start();
|
||||
});
|
||||
|
||||
asyncTest( "Media element as target", 2, function() {
|
||||
|
||||
var popped = Popcorn( "#video" ),
|
||||
containerAfterParse;
|
||||
|
||||
popped.text({
|
||||
start: 0,
|
||||
end: 10,
|
||||
text: "Text on video",
|
||||
target: "video"
|
||||
});
|
||||
|
||||
containerAfterParse = document.getElementById( "video-overlay" );
|
||||
|
||||
ok( !!containerAfterParse, "video-overlay container exists" );
|
||||
equal( containerAfterParse.children[ 0 ].innerHTML, "Text on video", "Text displayed in created overlay container" );
|
||||
|
||||
popped.destroy();
|
||||
start();
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче