Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: webmademovies/popcorn-js
base: master
...
head fork: aljohnson1/popcorn-js
Checking mergeability… Don't worry, you can still create the pull request.
  • 8 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
45 plugins/disabilitypause/popcorn.disabilitypause.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Popcorn Disabilitypause Plug-in Demo</title>
+
+ <script src="../../popcorn.js"></script>
+ <script src="popcorn.disabilitypause.js"></script>
+ <script>
+ document.addEventListener('DOMContentLoaded', function () {
+ var p = Popcorn( "#video" )
+ .play()
+ .disabilitypause({
+ start: 5,
+ pause: 5,
+ })
+ .disabilitypause({
+ start: 20,
+ pause: 5,
+ })
+ }, false);
+
+ </script>
+</head>
+<body>
+ <h1 id="qunit-header">Popcorn DisabilityPause Plug-in Demo</h1>
+ <p> This element will pause at 5 and 20 seconds for each 5 seconds.</p>
+ <div>
+ <video id="video"
+ controls preload="none"
+ width="250px"
+ poster="../../test/poster.png">
+
+ <source id="mp4"
+ src="../../test/trailer.mp4"
+ type='video/mp4; codecs="avc1, mp4a"'>
+
+ <source id="ogv"
+ src="../../test/trailer.ogv"
+ type='video/ogg; codecs="theora, vorbis"'>
+
+ <p>Your user agent does not support the HTML5 Video element.</p>
+
+ </video>
+ </body>
+</html>
View
79 plugins/disabilitypause/popcorn.disabilitypause.js
@@ -0,0 +1,79 @@
+// PLUGIN: Disabilitypause/text
+
+(function ( Popcorn ) {
+
+ /**
+ * Disabilitypause popcorn plug-in
+ * Pause a video element allowing audio for a blind person.
+ * Options parameter will need a start, end, target and text.
+ * Start is the time that you want this plug-in to execute
+ * End is the time that you want this plug-in to stop executing
+ * Text is the text that you want to appear in the target id applicable
+ * Target is the id of the document element that the text needs to be
+ * attached to, this target element must exist on the DOM
+ *
+ * @param {Object} options
+ *
+ * Example:
+ var p = Popcorn('#video')
+ .pauseoptions({
+ start: 5, // seconds
+ end: 15, // seconds
+ } )
+ *
+ */
+Popcorn.forEach( [ "disabilitypause" ], function( name ) {
+ Popcorn.plugin( name, {
+
+ manifest: {
+ about: {
+ name: "",
+ version: "",
+ author: "",
+ website: ""
+ },
+ options: {
+ start: {
+ elem: "input",
+ type: "text",
+ label: "In"
+ },
+ pause: {
+ elem: "input",
+ type: "text",
+ label: "Text"
+ },
+ target: "pause-container"
+ }
+ },
+ _setup: function( options ) {
+
+ },
+ /**
+ * @member diasbilitypause
+ * The start function will be executed when the currentTime
+ * of the video reaches the pause time provided by the
+ * options variable
+ */
+ start: function( event, options ){
+
+ if(options != undefined){
+ if(!this.paused()){
+ window.setTimeout(function(){
+ Popcorn.instances[0].play();
+ }, options.pause * 1000 );
+ Popcorn.instances[0].pause();
+ }
+ }
+ },
+ /**
+ * @member diasbilitypause
+ * The end function will be executed when the currentTime
+ * of the video reaches the end time provided by the
+ * options variable
+ */
+ end: function( event, options ){
+ }
+ });
+});
+})( Popcorn );
View
48 plugins/disabilitypause/popcorn.disabilitypause.unit.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Popcorn API</title>
+ <link rel="stylesheet" href="../../test/qunit/qunit.css" type="text/css" media="screen">
+ <script src="../../test/qunit/qunit.js"></script>
+ <!--
+ do not move - this must be called immediately prior to
+ popcorn-api-draft.js
+ -->
+
+ <script src="../../popcorn.js"></script>
+ <script src="popcorn.disabilitypause.js"></script>
+
+ <script src="popcorn.disabilitypause.unit.js"></script>
+</head>
+<body>
+ <h1 id="qunit-header">Popcorn Disabilitypause Plugin</h1>
+ <h2 id="qunit-banner"></h2>
+ <div id="qunit-testrunner-toolbar"></div>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture"> </div>
+
+ <video id="video"
+ controls preload="none"
+ width="250px"
+ poster="../../test/poster.png">
+
+ <source id="mp4"
+ src="../../test/trailer.mp4"
+ type='video/mp4; codecs="avc1, mp4a"'>
+
+ <source id="ogv"
+ src="../../test/trailer.ogv"
+ type='video/ogg; codecs="theora, vorbis"'>
+
+ <source id='webm'
+ src="../../test/trailer.webm"
+ type='video/webm; codecs="vp8, vorbis"'>
+
+ <p>Your user agent does not support the HTML5 Video element.</p>
+
+ </video>
+ <div id="footnotediv"></div>
+ <div id="textdiv"></div>
+</body>
+</html>
View
105 plugins/disabilitypause/popcorn.disabilitypause.unit.js
@@ -0,0 +1,105 @@
+test( "Popcorn Disabilitypause Plugin", function() {
+
+ var popcorn = Popcorn( "#video" ),
+ expects = 10,
+ count = 0,
+ setupId,
+ time = 0,
+ pauseStarted = 0,
+ pauseEnded = 0,
+ pauseDuration = 0,
+ dpausediv = document.getElementById( "dpausediv" );
+ expect( expects );
+
+ function plus() {
+ if ( ++count===expects ) {
+ start();
+ }
+ }
+ popcorn.disabilitypause({
+ start: 5,
+ pause: 5
+ })
+ .disabilitypause({
+ start: 20,
+ pause: 7
+ });
+
+ setupId = popcorn.getLastTrackEventId();
+ stop();
+ popcorn.play();
+
+ popcorn.exec( 0, function() {
+ equals(setupId.substring(0,15), "disabilitypause", "disability pause feature has been setup");
+ plus();
+ });
+
+ popcorn.exec( 3, function() {
+ ok( "disabilitypause" in popcorn, "disabilitypause is a mehtod of the Popcorn instance");
+ plus();
+ });
+
+ popcorn.exec( 5, function() {
+ ok(popcorn.paused(),"The video should be paused");
+ plus();
+ });
+
+ popcorn.exec( 5, function() {
+ time = new Date();
+ pauseStarted = time.getSeconds();
+ ok((popcorn.roundTime()-1) === 5,"The video should be paused at 5 seconds");
+ plus();
+ });
+
+ popcorn.exec( 6, function() {
+ time = new Date();
+ pauseEnded = time.getSeconds();
+ //Possibility of a rap around
+ if((pauseEnded - pauseStarted) > 6){
+ pauseDuration = (60 - pauseStarted) + pauseEnded;
+ }else{
+ pauseDuration = (pauseEnded - pauseStarted);
+ }
+ //Calculations could vary a littly based on a fraction of a second
+ ok(pauseDuration === 5 || 6,"The video should have been paused for 5 seconds");
+ plus();
+ });
+
+ popcorn.exec( 10, function() {
+ ok(!popcorn.paused(),"The video should not be paused");
+ plus();
+ });
+
+ popcorn.exec( 20, function() {
+ time = new Date();
+ pauseStarted = time.getSeconds();
+ ok(popcorn.paused(),"The video should be paused for a second time");
+ plus();
+ });
+
+ popcorn.exec( 20, function() {
+ ok((popcorn.roundTime()-1) === 20,"The video should be paused at 20 seconds");
+ plus();
+ });
+
+ popcorn.exec( 21, function() {
+ time = new Date();
+ pauseEnded = time.getSeconds();
+
+ //Possibility of a rap around
+ if((pauseEnded - pauseStarted) > 8){
+ pauseDuration = (60 - pauseStarted) + pauseEnded;
+ }else{
+ pauseDuration = (pauseEnded - pauseStarted);
+ }
+ //Calculations could vary a little based on a fraction of a second
+ ok(pauseDuration === 7 || 8,"The video should have been paused for 7 seconds");
+ plus();
+ });
+
+ popcorn.exec(21, function(){
+ ok(!popcorn.paused(),"The video should not be paused");
+ plus();
+ });
+});
+

No commit comments for this range

Something went wrong with that request. Please try again.