├── .gitattributes ├── .gitignore ├── AUTHORS ├── CHANGELOG.md ├── ISSUE_TEMPLATE.md ├── LICENSE ├── LICENSE_HEADER ├── Makefile ├── bower.json ├── build ├── google-compiler-20100917.jar ├── js.jar ├── jslint-check.js └── jslint.js ├── demos └── semantic_video │ ├── images │ ├── arro.png │ ├── body_bg.jpg │ ├── bubble_pointer.png │ ├── drumbeat_logo.png │ ├── expand_collapse.png │ ├── footer.jpg │ ├── footer_bg.jpg │ ├── footer_border.jpg │ ├── footer_drumbeat.png │ ├── footer_webmade.png │ ├── footnote.png │ ├── header.jpg │ ├── logo_flickr.png │ ├── logo_google_news.png │ ├── logo_lastfm.png │ ├── logo_tumblr.png │ ├── logo_twitter.png │ ├── logo_wiki.png │ ├── overlay │ │ ├── flickr.png │ │ ├── footnote.png │ │ ├── lastfm.png │ │ ├── location.png │ │ ├── twitter.png │ │ └── wiki.png │ └── video_icon.png │ ├── index.html │ ├── popcorn.applyclass.js │ ├── style.css │ └── xml │ └── webMadeMovies.xml ├── effects └── applyclass │ ├── popcorn.applyclass.html │ ├── popcorn.applyclass.js │ └── style.css ├── example.html ├── ie8 ├── popcorn.ie8.html ├── popcorn.ie8.js └── popcorn.ie8.unit.html ├── modules ├── locale │ ├── popcorn.locale.js │ ├── popcorn.locale.unit.html │ └── popcorn.locale.unit.js ├── parser │ ├── data │ │ ├── parseMissing.json │ │ ├── parserAudio.json │ │ └── parserData.json │ ├── popcorn.parser.js │ ├── popcorn.parser.unit.html │ └── popcorn.parser.unit.js ├── player │ ├── popcorn.player.js │ ├── popcorn.player.unit.html │ └── popcorn.player.unit.js └── timeline-sources │ ├── popcorn.timeline-sources.js │ ├── popcorn.timeline-sources.unit.html │ └── popcorn.timeline-sources.unit.js ├── parsers ├── parserJSON │ ├── data │ │ ├── audio.json │ │ ├── data.json │ │ └── video.json │ ├── popcorn.parserJSON.html │ ├── popcorn.parserJSON.js │ ├── popcorn.parserJSON.unit.html │ └── popcorn.parserJSON.unit.js ├── parserSBV │ ├── data │ │ └── data.sbv │ ├── popcorn.parserSBV.html │ ├── popcorn.parserSBV.js │ ├── popcorn.parserSBV.unit.html │ └── popcorn.parserSBV.unit.js ├── parserSRT │ ├── data │ │ ├── data.srt │ │ └── unit.srt │ ├── popcorn.parserSRT.html │ ├── popcorn.parserSRT.js │ ├── popcorn.parserSRT.unit.html │ └── popcorn.parserSRT.unit.js ├── parserSSA │ ├── data │ │ └── data.ssa │ ├── popcorn.parserSSA.html │ ├── popcorn.parserSSA.js │ ├── popcorn.parserSSA.unit.html │ └── popcorn.parserSSA.unit.js ├── parserTTML │ ├── data │ │ ├── data.ttml │ │ └── unit.ttml │ ├── popcorn.parserTTML.html │ ├── popcorn.parserTTML.js │ ├── popcorn.parserTTML.unit.html │ └── popcorn.parserTTML.unit.js ├── parserTTXT │ ├── data │ │ ├── data.TTXT │ │ └── unit.TTXT │ ├── popcorn.parserTTXT.html │ ├── popcorn.parserTTXT.js │ ├── popcorn.parserTTXT.unit.html │ └── popcorn.parserTTXT.unit.js ├── parserVTT │ ├── data │ │ ├── data.vtt │ │ └── unit.vtt │ ├── popcorn.parserVTT.html │ ├── popcorn.parserVTT.js │ ├── popcorn.parserVTT.unit.html │ └── popcorn.parserVTT.unit.js └── parserXML │ ├── data │ ├── data.XML │ └── unit.XML │ ├── popcorn.parserXML.html │ ├── popcorn.parserXML.js │ ├── popcorn.parserXML.unit.html │ └── popcorn.parserXML.unit.js ├── players ├── soundcloud │ ├── popcorn.soundcloud.html │ └── popcorn.soundcloud.js ├── vimeo │ ├── popcorn.vimeo.html │ ├── popcorn.vimeo.js │ ├── popcorn.vimeo.unit.html │ └── popcorn.vimeo.unit.js └── youtube │ ├── popcorn.youtube.html │ └── popcorn.youtube.js ├── plugins ├── code │ ├── popcorn.code.html │ ├── popcorn.code.js │ ├── popcorn.code.unit.html │ └── popcorn.code.unit.js ├── documentcloud │ ├── popcorn.documentcloud.html │ ├── popcorn.documentcloud.js │ ├── popcorn.documentcloud.unit.html │ └── popcorn.documentcloud.unit.js ├── flickr │ ├── popcorn.flickr.html │ ├── popcorn.flickr.js │ ├── popcorn.flickr.unit.html │ └── popcorn.flickr.unit.js ├── footnote │ ├── popcorn.footnote.html │ ├── popcorn.footnote.js │ ├── popcorn.footnote.unit.html │ └── popcorn.footnote.unit.js ├── googlefeed │ ├── popcorn.googlefeed.html │ ├── popcorn.googlefeed.js │ ├── popcorn.googlefeed.unit.html │ └── popcorn.googlefeed.unit.js ├── googlemap │ ├── popcorn.googlemap.html │ ├── popcorn.googlemap.js │ ├── popcorn.googlemap.unit.html │ └── popcorn.googlemap.unit.js ├── image │ ├── popcorn.image.html │ ├── popcorn.image.js │ ├── popcorn.image.unit.html │ └── popcorn.image.unit.js ├── mediaspawner │ ├── popcorn.mediaspawner.html │ ├── popcorn.mediaspawner.js │ ├── popcorn.mediaspawner.unit.html │ └── popcorn.mediaspawner.unit.js ├── mustache │ ├── popcorn.mustache.html │ ├── popcorn.mustache.js │ ├── popcorn.mustache.unit.html │ └── popcorn.mustache.unit.js ├── openmap │ ├── popcorn.openmap.html │ ├── popcorn.openmap.js │ ├── popcorn.openmap.unit.html │ └── popcorn.openmap.unit.js ├── pause │ ├── popcorn.pause.html │ ├── popcorn.pause.js │ ├── popcorn.pause.unit.html │ └── popcorn.pause.unit.js ├── subtitle │ ├── popcorn.subtitle.html │ ├── popcorn.subtitle.js │ ├── popcorn.subtitle.unit.html │ └── popcorn.subtitle.unit.js ├── text │ ├── popcorn.text.html │ ├── popcorn.text.js │ ├── popcorn.text.unit.html │ └── popcorn.text.unit.js ├── timeline │ ├── popcorn.timeline.html │ ├── popcorn.timeline.js │ ├── popcorn.timeline.unit.html │ └── popcorn.timeline.unit.js ├── webpage │ ├── popcorn.webpage.html │ ├── popcorn.webpage.js │ ├── popcorn.webpage.unit.html │ └── popcorn.webpage.unit.js ├── wikipedia │ ├── popcorn.wikipedia.html │ ├── popcorn.wikipedia.js │ ├── popcorn.wikipedia.unit.html │ └── popcorn.wikipedia.unit.js └── wordriver │ ├── popcorn.wordriver.html │ ├── popcorn.wordriver.js │ ├── popcorn.wordriver.unit.html │ └── popcorn.wordriver.unit.js ├── popcorn.js ├── readme.md ├── test ├── archaic.html ├── butter.unit.js ├── butter_test.html ├── core.html ├── data │ ├── jsonp.json │ ├── jsonp.php │ ├── jsonpfancyapi.php │ ├── method.php │ ├── remoteA.js │ ├── remoteB.js │ ├── test.js │ ├── test.ttml │ ├── test.txt │ ├── test.xml │ ├── testfunction.js │ └── testfunction2.js ├── index.html ├── inject.js ├── italia.mp4 ├── italia.ogg ├── jquery.js ├── popcorn.inject.js ├── popcorn.testrunner.css ├── popcorn.testrunner.js ├── popcorn.unit.archaic.js ├── popcorn.unit.archaic.setup.js ├── popcorn.unit.js ├── popcorn.unit.setup.js ├── poster.png ├── qunit │ ├── qunit.css │ └── qunit.js ├── ready.html ├── silence.mp3 ├── trailer.mp4 ├── trailer.ogv └── trailer.webm ├── tests.conf ├── tools ├── cleaner.js ├── jslint-cmdline.js ├── jslint.py └── jsshellhelper.py ├── unsupported ├── attribution │ ├── popcorn.attribution.html │ ├── popcorn.attribution.js │ ├── popcorn.attribution.unit.html │ └── popcorn.attribution.unit.js ├── facebook │ ├── popcorn.facebook.html │ ├── popcorn.facebook.js │ ├── popcorn.facebook.unit.html │ └── popcorn.facebook.unit.js ├── gml │ ├── popcorn.gml.html │ ├── popcorn.gml.js │ ├── popcorn.gml.unit.html │ └── popcorn.gml.unit.js ├── lastfm │ ├── popcorn.lastfm.html │ ├── popcorn.lastfm.js │ ├── popcorn.lastfm.unit.html │ └── popcorn.lastfm.unit.js ├── linkedin │ ├── popcorn.linkedin.html │ ├── popcorn.linkedin.js │ ├── popcorn.linkedin.unit.html │ └── popcorn.linkedin.unit.js ├── lowerthird │ ├── popcorn.lowerthird.html │ ├── popcorn.lowerthird.js │ ├── popcorn.lowerthird.unit.html │ └── popcorn.lowerthird.unit.js ├── processing │ ├── popcorn.processing.html │ ├── popcorn.processing.js │ ├── popcorn.processing.unit.html │ ├── popcorn.processing.unit.js │ ├── test.pjs │ └── test2.pjs ├── rdio │ ├── popcorn.rdio.html │ ├── popcorn.rdio.js │ ├── popcorn.rdio.unit.html │ └── popcorn.rdio.unit.js ├── tagthisperson │ ├── popcorn.tagthisperson.html │ ├── popcorn.tagthisperson.js │ ├── popcorn.tagthisperson.unit.html │ └── popcorn.tagthisperson.unit.js └── tumblr │ ├── popcorn.tumblr.html │ ├── popcorn.tumblr.js │ ├── popcorn.tumblr.unit.html │ └── popcorn.tumblr.unit.js └── wrappers ├── common ├── common.unit.js └── popcorn._MediaElementProto.js ├── html5 ├── popcorn.HTMLMediaElement.js ├── popcorn.HTMLVideoElement.unit.html └── popcorn.HTMLVideoElement.unit.js ├── jwplayer ├── popcorn.HTMLJWPlayerVideoElement.js ├── popcorn.HTMLJWPlayerVideoElement.unit.html └── popcorn.HTMLJWPlayerVideoElement.unit.js ├── null ├── popcorn.HTMLNullVideoElement.js ├── popcorn.HTMLNullVideoElement.unit.html └── popcorn.HTMLNullVideoElement.unit.js ├── soundcloud ├── popcorn.HTMLSoundCloudAudioElement.js ├── popcorn.HTMLSoundCloudAudioElement.unit.html └── popcorn.HTMLSoundCloudAudioElement.unit.js ├── vimeo ├── popcorn.HTMLVimeoVideoElement.js ├── popcorn.HTMLVimeoVideoElement.unit.html └── popcorn.HTMLVimeoVideoElement.unit.js └── youtube ├── popcorn.HTMLYouTubeVideoElement.js ├── popcorn.HTMLYouTubeVideoElement.unit.html └── popcorn.HTMLYouTubeVideoElement.unit.js /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | dist 3 | *~ 4 | \.\#* 5 | \#*\# -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Anna Sobiepanek 2 | Rick Waldron 3 | Scott Downe 4 | David Humphrey 5 | Nick Cammarata 6 | Daniel Hodgin 7 | Daniel Brooks 8 | Brett Gaylor 9 | Boaz Sender 10 | Dan Ventura 11 | Brad Chen 12 | Minoo Ziaei 13 | Cesar Gomes 14 | David Seifried 15 | Steven Weerdenburg 16 | Christopher De Cairos 17 | Mohammed Buttu 18 | Cole Gillespie 19 | Nick Doiron 20 | Bobby Richter 21 | Jon Buckley 22 | Matthew Schranz 23 | Brian Chirls 24 | Charlie Stigler 25 | Kate Hudson 26 | Denise Rigato 27 | Robert Stanica 28 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Thank you for finding a bug in Popcorn.js, or having a feature request you'd like to see added. 2 | 3 | **Please Note:** Popcorn.js is no longer maintenance by mozilla, and as such: any bug you find will probably not get fixed until this project finds new owners/maintainers. 4 | 5 | If you think: "that's me!" then please get in touch and we can start the process of transferring ownership of this project to you! 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010, 2011 Mozilla Foundation 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /LICENSE_HEADER: -------------------------------------------------------------------------------- 1 | /* 2 | * popcorn.js version @VERSION 3 | * http://popcornjs.org 4 | * 5 | * Copyright 2011, Mozilla Foundation 6 | * Licensed under the MIT license 7 | */ 8 | 9 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "popcorn-js", 3 | "version": "1.5.10", 4 | "main": "popcorn.js", 5 | "keywords": [ 6 | "html5", 7 | "media", 8 | "video", 9 | "audio", 10 | "popcornjs", 11 | "popcorn", 12 | "popcorn.js" 13 | ], 14 | "ignore": [ 15 | "AUTHORS", 16 | "CHANGELOG.md", 17 | "LICENSE_HEADER", 18 | "Makefile", 19 | "build", 20 | "demos", 21 | "effects", 22 | "example.html", 23 | "test", 24 | "tests.conf", 25 | "tools", 26 | "unsupported" 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /build/google-compiler-20100917.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/build/google-compiler-20100917.jar -------------------------------------------------------------------------------- /build/js.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/build/js.jar -------------------------------------------------------------------------------- /build/jslint-check.js: -------------------------------------------------------------------------------- 1 | load("build/jslint.js"); 2 | 3 | // All of the following are known issues that we think are 'ok' 4 | // (in contradiction with JSLint) more information here: 5 | // http://docs.jquery.com/JQuery_Core_Style_Guidelines 6 | var ok = { 7 | "Expected an identifier and instead saw 'undefined' (a reserved word).": true, 8 | "Use '===' to compare with 'null'.": true, 9 | "Use '!==' to compare with 'null'.": true, 10 | "Expected an assignment or function call and instead saw an expression.": true, 11 | "Expected a 'break' statement before 'case'.": true, 12 | "'e' is already defined.": true, 13 | "Don't make functions within a loop.": true, 14 | "['out'] is better written in dot notation.": true 15 | }; 16 | 17 | function check(src) 18 | { 19 | JSLINT(src, { evil: true, forin: true, maxerr: 100 }); 20 | 21 | var e = JSLINT.errors, found = 0, w; 22 | for ( var i = 0; e && i < e.length; i++ ) { 23 | w = e[i]; 24 | 25 | if ( w && !ok[ w.reason ] ) { 26 | found++; 27 | print( "\n" + w.evidence + "\n" ); 28 | print( " Problem at line " + w.line + " character " + w.character + ": " + w.reason ); 29 | } 30 | } 31 | 32 | if ( found > 0 ) { 33 | print( "\n" + found + " Error(s) found." ); 34 | } else { 35 | print( "JSLint check passed." ); 36 | } 37 | } 38 | 39 | for each (var f in arguments) 40 | { 41 | print( "Linting "+ f ); 42 | check(readFile(f)); 43 | } 44 | -------------------------------------------------------------------------------- /demos/semantic_video/images/arro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/arro.png -------------------------------------------------------------------------------- /demos/semantic_video/images/body_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/body_bg.jpg -------------------------------------------------------------------------------- /demos/semantic_video/images/bubble_pointer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/bubble_pointer.png -------------------------------------------------------------------------------- /demos/semantic_video/images/drumbeat_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/drumbeat_logo.png -------------------------------------------------------------------------------- /demos/semantic_video/images/expand_collapse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/expand_collapse.png -------------------------------------------------------------------------------- /demos/semantic_video/images/footer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/footer.jpg -------------------------------------------------------------------------------- /demos/semantic_video/images/footer_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/footer_bg.jpg -------------------------------------------------------------------------------- /demos/semantic_video/images/footer_border.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/footer_border.jpg -------------------------------------------------------------------------------- /demos/semantic_video/images/footer_drumbeat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/footer_drumbeat.png -------------------------------------------------------------------------------- /demos/semantic_video/images/footer_webmade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/footer_webmade.png -------------------------------------------------------------------------------- /demos/semantic_video/images/footnote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/footnote.png -------------------------------------------------------------------------------- /demos/semantic_video/images/header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/header.jpg -------------------------------------------------------------------------------- /demos/semantic_video/images/logo_flickr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/logo_flickr.png -------------------------------------------------------------------------------- /demos/semantic_video/images/logo_google_news.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/logo_google_news.png -------------------------------------------------------------------------------- /demos/semantic_video/images/logo_lastfm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/logo_lastfm.png -------------------------------------------------------------------------------- /demos/semantic_video/images/logo_tumblr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/logo_tumblr.png -------------------------------------------------------------------------------- /demos/semantic_video/images/logo_twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/logo_twitter.png -------------------------------------------------------------------------------- /demos/semantic_video/images/logo_wiki.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/logo_wiki.png -------------------------------------------------------------------------------- /demos/semantic_video/images/overlay/flickr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/overlay/flickr.png -------------------------------------------------------------------------------- /demos/semantic_video/images/overlay/footnote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/overlay/footnote.png -------------------------------------------------------------------------------- /demos/semantic_video/images/overlay/lastfm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/overlay/lastfm.png -------------------------------------------------------------------------------- /demos/semantic_video/images/overlay/location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/overlay/location.png -------------------------------------------------------------------------------- /demos/semantic_video/images/overlay/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/overlay/twitter.png -------------------------------------------------------------------------------- /demos/semantic_video/images/overlay/wiki.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/overlay/wiki.png -------------------------------------------------------------------------------- /demos/semantic_video/images/video_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/demos/semantic_video/images/video_icon.png -------------------------------------------------------------------------------- /demos/semantic_video/popcorn.applyclass.js: -------------------------------------------------------------------------------- 1 | // EFFECT: applyclass 2 | 3 | (function (Popcorn) { 4 | 5 | /** 6 | * apply css class to jquery selector 7 | * selector is relative to plugin target's id 8 | * so .overlay is actually jQuery( "#target .overlay") 9 | * 10 | * @param {Object} options 11 | * 12 | * Example: 13 | var p = Popcorn('#video') 14 | .footnote({ 15 | start: 5, // seconds 16 | end: 15, // seconds 17 | text: 'This video made exclusively for drumbeat.org', 18 | target: 'footnotediv', 19 | effect: 'applyclass', 20 | applyclass: 'selector: class' 21 | }) 22 | * 23 | */ 24 | 25 | Popcorn.compose( "applyclass", { 26 | 27 | manifest: { 28 | about: { 29 | name: "Popcorn applyclass Effect", 30 | version: "0.1", 31 | author: "@scottdowne", 32 | website: "scottdowne.wordpress.com" 33 | }, 34 | options: {} 35 | }, 36 | _setup: function( options ) { 37 | 38 | options.classes = {}; 39 | options.applyclass = options.applyclass || ""; 40 | 41 | var classes = options.applyclass.replace( /\s/g, "" ).split( "," ), 42 | item = [], 43 | idx = 0, len = classes.length; 44 | 45 | for ( ; idx < len; idx++ ) { 46 | 47 | item = classes[ idx ].split( ":" ); 48 | 49 | if ( item[ 0 ] ) { 50 | options.classes[ item[ 0 ] ] = item[ 1 ] || ""; 51 | } 52 | } 53 | }, 54 | start: function( event, options ) { 55 | 56 | var idx = 0, len = 0, elements; 57 | 58 | Popcorn.forEach( options.classes, function( key, val ) { 59 | 60 | elements = []; 61 | 62 | if ( key === "parent" ) { 63 | 64 | var item = document.querySelectorAll("#" + options.target )[ 0 ]; 65 | 66 | item && item.parentNode && elements.push( item.parentNode ); 67 | } else { 68 | 69 | elements = document.querySelectorAll("#" + options.target + " " + key ); 70 | } 71 | 72 | for ( idx = 0, len = elements.length; idx < len; idx++ ) { 73 | 74 | var element = elements[ idx ]; 75 | element.classList.toggle( val ); 76 | 77 | setTimeout( function() { 78 | 79 | element.classList.toggle( val ); 80 | }, 250 ); 81 | } 82 | }); 83 | } 84 | }); 85 | })( Popcorn ); 86 | -------------------------------------------------------------------------------- /effects/applyclass/popcorn.applyclass.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn flash effect Demo 5 | 6 | 7 | 8 | 9 | 10 | 33 | 34 | 35 |

Popcorn flash effect Demo

36 |

A footnote with a css class displaying This video made exclusively for drumbeat.org' will appear at 5 seconds and disappear at 15 seconds.

37 |

A footnote with a css class displaying 'Visit webmademovies.org for more details' will appear at 20 seconds and disappear at 45 seconds.

38 |
39 | 59 |
60 |
61 |
62 |
63 | 64 | 65 | -------------------------------------------------------------------------------- /effects/applyclass/popcorn.applyclass.js: -------------------------------------------------------------------------------- 1 | // EFFECT: applyclass 2 | 3 | (function (Popcorn) { 4 | 5 | /** 6 | * apply css class to jquery selector 7 | * selector is relative to plugin target's id 8 | * so .overlay is actually jQuery( "#target .overlay") 9 | * 10 | * @param {Object} options 11 | * 12 | * Example: 13 | var p = Popcorn('#video') 14 | .footnote({ 15 | start: 5, // seconds 16 | end: 15, // seconds 17 | text: 'This video made exclusively for drumbeat.org', 18 | target: 'footnotediv', 19 | effect: 'applyclass', 20 | applyclass: 'selector: class' 21 | }) 22 | * 23 | */ 24 | 25 | var toggleClass = function( event, options ) { 26 | 27 | var idx = 0, len = 0, elements; 28 | 29 | Popcorn.forEach( options.classes, function( key, val ) { 30 | 31 | elements = []; 32 | 33 | if ( key === "parent" ) { 34 | 35 | elements[ 0 ] = document.querySelectorAll("#" + options.target )[ 0 ].parentNode; 36 | } else { 37 | 38 | elements = document.querySelectorAll("#" + options.target + " " + key ); 39 | } 40 | 41 | for ( idx = 0, len = elements.length; idx < len; idx++ ) { 42 | 43 | elements[ idx ].classList.toggle( val ); 44 | } 45 | }); 46 | }; 47 | 48 | Popcorn.compose( "applyclass", { 49 | 50 | manifest: { 51 | about: { 52 | name: "Popcorn applyclass Effect", 53 | version: "0.1", 54 | author: "@scottdowne", 55 | website: "scottdowne.wordpress.com" 56 | }, 57 | options: {} 58 | }, 59 | _setup: function( options ) { 60 | 61 | options.classes = {}; 62 | options.applyclass = options.applyclass || ""; 63 | 64 | var classes = options.applyclass.replace( /\s/g, "" ).split( "," ), 65 | item = [], 66 | idx = 0, len = classes.length; 67 | 68 | for ( ; idx < len; idx++ ) { 69 | 70 | item = classes[ idx ].split( ":" ); 71 | 72 | if ( item[ 0 ] ) { 73 | options.classes[ item[ 0 ] ] = item[ 1 ] || ""; 74 | } 75 | } 76 | }, 77 | start: toggleClass, 78 | end: toggleClass 79 | }); 80 | })( Popcorn ); 81 | -------------------------------------------------------------------------------- /effects/applyclass/style.css: -------------------------------------------------------------------------------- 1 | .applyoverlay { 2 | z-index: 9001; 3 | top: 0px; 4 | left: 0px; 5 | opacity: 0.2; 6 | filter: alpha(opacity=20); 7 | height: 100%; 8 | width: 100%; 9 | background: red; 10 | position: absolute; 11 | } 12 | 13 | section { 14 | display: inline-block; 15 | } 16 | 17 | section.hover { 18 | -webkit-box-shadow: -1px 1px 1px #bdc7c6; 19 | -moz-box-shadow: -1px 1px 1px #bdc7c6; 20 | box-shadow: -1px 1px 1px #bdc7c6; 21 | border: 1px solid #333; 22 | -moz-transform: scale(1.02);-webkit-transform: scale(1.02); 23 | z-index: 999; 24 | background: #FFF; 25 | } 26 | 27 | .test1 { 28 | background: green 29 | } 30 | 31 | .test2 { 32 | -webkit-box-shadow: -1px 1px 1px #bdc7c6; 33 | -moz-box-shadow: -1px 1px 1px #bdc7c6; 34 | box-shadow: -1px 1px 1px #bdc7c6; 35 | border: 1px solid #333; 36 | } 37 | -------------------------------------------------------------------------------- /example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn Simple Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 43 | 44 | 45 |

Popcorn Simple Demo

46 |

You should see a footnote "This video made exclusively for drumbeat.org" appear right away

47 |

You should see a subtitle "this is a subtitle" appear at 1 sec away

48 | 49 | 61 | 62 |
63 | 64 | 65 | -------------------------------------------------------------------------------- /ie8/popcorn.ie8.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn YouTube Player - IE8 Shim 5 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |

Popcorn YouTube Player Plugin - with IE8 Shim

22 |

23 |
24 |

25 |
    26 |
    27 | 28 |

    29 | Note about this set of tests: 30 |

    31 | 32 |

    33 | The test assumes that the YouTube video is mostly loaded, before it is run. 34 | Therefore, if failures occur for the first time, just run it again. Likely, 35 | failures would disappear the second time. 36 |

    37 |

    38 | There will be two separate youtube videos visible after the completion of these tests. 39 |

    40 |
    41 |
    42 |
    43 |
    44 |
    45 |
    46 |
    47 |
    48 |
    49 |
    50 |
    51 |
    52 |
    53 |
    54 |
    55 |
    56 | 57 | 58 | -------------------------------------------------------------------------------- /modules/locale/popcorn.locale.js: -------------------------------------------------------------------------------- 1 | (function( global, Popcorn ) { 2 | 3 | var navigator = global.navigator; 4 | 5 | // Initialize locale data 6 | // Based on http://en.wikipedia.org/wiki/Language_localisation#Language_tags_and_codes 7 | function initLocale( arg ) { 8 | 9 | var locale = typeof arg === "string" ? arg : [ arg.language, arg.region ].join( "-" ), 10 | parts = locale.split( "-" ); 11 | 12 | // Setup locale data table 13 | return { 14 | iso6391: locale, 15 | language: parts[ 0 ] || "", 16 | region: parts[ 1 ] || "" 17 | }; 18 | } 19 | 20 | // Declare locale data table 21 | var localeData = initLocale( navigator.userLanguage || navigator.language ); 22 | 23 | Popcorn.locale = { 24 | 25 | // Popcorn.locale.get() 26 | // returns reference to privately 27 | // defined localeData 28 | get: function() { 29 | return localeData; 30 | }, 31 | 32 | // Popcorn.locale.set( string|object ); 33 | set: function( arg ) { 34 | 35 | localeData = initLocale( arg ); 36 | 37 | Popcorn.locale.broadcast(); 38 | 39 | return localeData; 40 | }, 41 | 42 | // Popcorn.locale.broadcast( type ) 43 | // Sends events to all popcorn media instances that are 44 | // listening for locale events 45 | broadcast: function( type ) { 46 | 47 | var instances = Popcorn.instances, 48 | length = instances.length, 49 | idx = 0, 50 | instance; 51 | 52 | type = type || "locale:changed"; 53 | 54 | // Iterate all current instances 55 | for ( ; idx < length; idx++ ) { 56 | instance = instances[ idx ]; 57 | 58 | // For those instances with locale event listeners, 59 | // trigger a locale change event 60 | if ( type in instance.data.events ) { 61 | instance.trigger( type ); 62 | } 63 | } 64 | } 65 | }; 66 | })( this, this.Popcorn ); -------------------------------------------------------------------------------- /modules/locale/popcorn.locale.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn Module: Locale 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

    Popcorn Module: Locale

    16 |

    17 |
    18 |

    19 |
      20 |
      21 | 22 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /modules/locale/popcorn.locale.unit.js: -------------------------------------------------------------------------------- 1 | (function( Popcorn ) { 2 | 3 | module( "Popcorn Locale" ); 4 | 5 | asyncTest( "Popcorn.locale object", function() { 6 | 7 | var api = { 8 | get: "function", 9 | set: "function", 10 | broadcast: "function" 11 | }, 12 | locale = navigator.userLanguage || navigator.language, 13 | parts = locale.split( "-" ), 14 | 15 | stub = { 16 | iso6391: locale, 17 | language: parts[ 0 ], 18 | region: parts[ 1 ] 19 | }, 20 | $pop = Popcorn( "#video" ), 21 | expects = 18, 22 | count = 0; 23 | 24 | expect( expects ); 25 | 26 | function plus() { 27 | if ( ++count == expects ) { 28 | start(); 29 | } 30 | } 31 | 32 | ok( Popcorn.locale, "Popcorn.locale exists"); 33 | plus(); 34 | 35 | equal( typeof Popcorn.locale, "object", "Popcorn.locale is an object" ); 36 | plus(); 37 | 38 | Popcorn.forEach( api, function( type, method ) { 39 | ok( Popcorn.locale[ method ], "Popcorn.locale." + method + "() exists" ); 40 | plus(); 41 | equal( typeof Popcorn.locale[ method ], type, "Popcorn.locale." + method + "() is a " + type ); 42 | plus(); 43 | }); 44 | 45 | deepEqual( Popcorn.locale.get(), stub, "Popcorn.locale.get() === navigator.language (" + JSON.stringify( stub ) + ") whenever possible" ); 46 | plus(); 47 | 48 | Popcorn.forEach( Popcorn.locale.get(), function( val, prop ) { 49 | equal( val, stub[ prop ], "Popcorn.locale.get() locale matches stub" ); 50 | plus(); 51 | }); 52 | 53 | locale = "fr-CA"; 54 | 55 | // Setup "locale:changed" event listener 56 | $pop.listen( "locale:changed", function() { 57 | 58 | var parts = locale.split( "-" ), 59 | stub = { 60 | iso6391: locale, 61 | language: parts[ 0 ], 62 | region: parts[ 1 ] 63 | }; 64 | 65 | 66 | Popcorn.forEach( Popcorn.locale.get(), function( val, prop ) { 67 | equal( val, stub[ prop ], "Popcorn.locale.set() -> get() locale matches updated stub" ); 68 | plus(); 69 | }); 70 | 71 | if ( locale === "fr-CA" ) { 72 | locale = "en-CA"; 73 | 74 | // Change locale, trigger "locale:changed" event 75 | Popcorn.locale.set( "en-CA" ); 76 | } 77 | }); 78 | 79 | // Change locale, trigger "locale:changed" event 80 | Popcorn.locale.set( "fr-CA" ); 81 | }); 82 | 83 | })( Popcorn ); -------------------------------------------------------------------------------- /modules/parser/data/parseMissing.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [ 3 | { 4 | "parserMissing": { 5 | "start": 5, 6 | "end": 6 7 | } 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /modules/parser/data/parserAudio.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [ 3 | { 4 | "testAudioParser": { 5 | "start": 5, 6 | "end": 6 7 | } 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /modules/parser/data/parserData.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [ 3 | { 4 | "parserTest": { 5 | "start": 5, 6 | "end": 6 7 | } 8 | } 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /modules/parser/popcorn.parser.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn Module: Timeline-Sources 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

      Popcorn Module: player

      16 |

      17 |
      18 |

      19 |
        20 |
        21 | 22 | 42 | 43 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /modules/player/popcorn.player.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn Module: Timeline-Sources 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |

        Popcorn Module: player

        23 |

        24 |
        25 |

        26 |
          27 |
          28 | 29 |
          30 |
          31 | 32 | 33 |
          34 |
          35 |
          36 |
          37 |
          38 |
          39 |
          40 |
          41 |
          42 |
          43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /modules/timeline-sources/popcorn.timeline-sources.js: -------------------------------------------------------------------------------- 1 | (function( Popcorn ) { 2 | document.addEventListener( "DOMContentLoaded", function() { 3 | 4 | // Supports non-specific elements 5 | var dataAttr = "data-timeline-sources", 6 | medias = document.querySelectorAll( "[" + dataAttr + "]" ); 7 | 8 | Popcorn.forEach( medias, function( idx, key ) { 9 | 10 | var media = medias[ key ], 11 | hasDataSources = false, 12 | dataSources, data, popcornMedia; 13 | 14 | // Ensure that the DOM has an id 15 | if ( !media.id ) { 16 | 17 | media.id = Popcorn.guid( "__popcorn" ); 18 | } 19 | 20 | // Ensure we're looking at a dom node 21 | if ( media.nodeType && media.nodeType === 1 ) { 22 | 23 | popcornMedia = Popcorn( "#" + media.id ); 24 | 25 | dataSources = ( media.getAttribute( dataAttr ) || "" ).split( "," ); 26 | 27 | if ( dataSources[ 0 ] ) { 28 | 29 | Popcorn.forEach( dataSources, function( source ) { 30 | 31 | // split the parser and data as parser!file 32 | data = source.split( "!" ); 33 | 34 | // if no parser is defined for the file, assume "parse" + file extension 35 | if ( data.length === 1 ) { 36 | 37 | // parse a relative URL for the filename, split to get extension 38 | data = source.match( /(.*)[\/\\]([^\/\\]+\.\w+)$/ )[ 2 ].split( "." ); 39 | 40 | data[ 0 ] = "parse" + data[ 1 ].toUpperCase(); 41 | data[ 1 ] = source; 42 | } 43 | 44 | // If the media has data sources and the correct parser is registered, continue to load 45 | if ( dataSources[ 0 ] && popcornMedia[ data[ 0 ] ] ) { 46 | 47 | // Set up the media and load in the datasources 48 | popcornMedia[ data[ 0 ] ]( data[ 1 ] ); 49 | 50 | } 51 | }); 52 | 53 | } 54 | 55 | // Only play the media if it was specified to do so 56 | if ( !!popcornMedia.autoplay() ) { 57 | popcornMedia.play(); 58 | } 59 | 60 | } 61 | }); 62 | }, false ); 63 | 64 | })( Popcorn ); -------------------------------------------------------------------------------- /modules/timeline-sources/popcorn.timeline-sources.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn Module: Timeline-Sources 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |

          Popcorn Module: timeline-sources

          18 |

          19 |
          20 |

          21 |
            22 |
            23 | 24 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /modules/timeline-sources/popcorn.timeline-sources.unit.js: -------------------------------------------------------------------------------- 1 | (function( Popcorn ) { 2 | 3 | var setupCalled = 0, 4 | startCalled = 0, 5 | endCalled = 0; 6 | 7 | Popcorn.plugin( "footnote", function( options ) { 8 | return { 9 | _setup: function() { 10 | setupCalled++; 11 | }, 12 | start: function() { 13 | startCalled++; 14 | }, 15 | end: function() { 16 | endCalled++; 17 | } 18 | }; 19 | }); 20 | 21 | Popcorn.plugin( "googlemap", function( options ) { 22 | return { 23 | _setup: function() { 24 | setupCalled++; 25 | }, 26 | start: function() { 27 | startCalled++; 28 | }, 29 | end: function() { 30 | endCalled++; 31 | } 32 | }; 33 | }); 34 | 35 | Popcorn.plugin( "webpage", function( options ) { 36 | return { 37 | _setup: function() { 38 | setupCalled++; 39 | }, 40 | start: function() { 41 | startCalled++; 42 | }, 43 | end: function() { 44 | endCalled++; 45 | } 46 | }; 47 | }); 48 | 49 | test( "Timeline-sources Module", function() { 50 | 51 | var count = 0, 52 | expects = 4, 53 | p = Popcorn.instances[ 0 ].volume( 0 ); 54 | 55 | expect( expects ); 56 | function plus() { 57 | if ( ++count === expects ) { 58 | start(); 59 | } 60 | } 61 | 62 | stop(); 63 | 64 | p.exec( 3, function() { 65 | equal( startCalled, 5, "start was called 5 times from the parsed data" ); 66 | plus(); 67 | p.currentTime( 9 ); 68 | }); 69 | 70 | p.exec( 10.5, function() { 71 | equal( endCalled, 5, "end was called 5 times from the parsed data" ); 72 | plus(); 73 | }); 74 | 75 | equal( setupCalled, 5, "setup was called 5 times from the parsed data" ); 76 | plus(); 77 | 78 | equal( p.paused(), true, "Only play the media if it was specified to do so" ); 79 | plus(); 80 | 81 | p.play(); 82 | }); 83 | 84 | })( Popcorn ); -------------------------------------------------------------------------------- /parsers/parserJSON/data/audio.json: -------------------------------------------------------------------------------- 1 | { 2 | "title":"Crockford Lives!", 3 | "remote":"http://dl.dropbox.com/u/3531958/crockford.ogv", 4 | "data": [ 5 | { 6 | "webpage": { 7 | "start":"0.0897589878863602", 8 | "end":"2.001204869833337", 9 | "target":"audio-iframe-container", 10 | "src":"http://json.org" 11 | } 12 | }, 13 | { 14 | "footnote": { 15 | "start":"0.23530116023787565", 16 | "end":"2.0193976413772767", 17 | "target":"audio-footnote-container", 18 | "text":"I invented JSON" 19 | } 20 | }, 21 | { 22 | "googlemap": { 23 | "start":"0.09096385771969716", 24 | "end":"8.617349362660605", 25 | "target":"audio-map-container", 26 | "type":"ROADMAP", 27 | "lat":37.7749295, 28 | "lng":-122.4194155, 29 | "location":"San Francisco, CA" 30 | } 31 | }, 32 | { 33 | "webpage": { 34 | "start":"2.073975956009095", 35 | "end":"10.278915922325776", 36 | "target":"audio-iframe-container", 37 | "src":"http://jslint.org" 38 | } 39 | }, 40 | { 41 | "footnote": { 42 | "start":2.145542172351516, 43 | "end":10.145542172351513, 44 | "target":"audio-footnote-container", 45 | "text":"I wrote JSLint" 46 | } 47 | } 48 | ] 49 | } 50 | -------------------------------------------------------------------------------- /parsers/parserJSON/data/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "title":"Crockford Lives!", 3 | "remote":"http://dl.dropbox.com/u/3531958/crockford.ogv", 4 | "data": [ 5 | { 6 | "webpage": { 7 | "start":"0.0897589878863602", 8 | "end":"2.001204869833337", 9 | "target":"iframe-container", 10 | "src":"http://json.org" 11 | } 12 | }, 13 | { 14 | "footnote": { 15 | "start":"0.23530116023787565", 16 | "end":"2.0193976413772767", 17 | "target":"footnote-container", 18 | "text":"I invented JSON" 19 | } 20 | }, 21 | { 22 | "googlemap": { 23 | "start":"0.09096385771969716", 24 | "end":"8.617349362660605", 25 | "target":"map-container", 26 | "type":"ROADMAP", 27 | "lat":37.7749295, 28 | "lng":-122.4194155, 29 | "location":"San Francisco, CA" 30 | } 31 | }, 32 | { 33 | "webpage": { 34 | "start":"2.073975956009095", 35 | "end":"10.278915922325776", 36 | "target":"iframe-container", 37 | "src":"http://jslint.org" 38 | } 39 | }, 40 | { 41 | "footnote": { 42 | "start":2.145542172351516, 43 | "end":10.145542172351513, 44 | "target":"footnote-container", 45 | "text":"I wrote JSLint" 46 | } 47 | } 48 | ] 49 | } -------------------------------------------------------------------------------- /parsers/parserJSON/data/video.json: -------------------------------------------------------------------------------- 1 | { 2 | "title":"Crockford Lives!", 3 | "remote":"http://dl.dropbox.com/u/3531958/crockford.ogv", 4 | "data": [ 5 | { 6 | "webpage": { 7 | "start":"0.0897589878863602", 8 | "end":"2.001204869833337", 9 | "target":"video-iframe-container", 10 | "src":"http://json.org" 11 | } 12 | }, 13 | { 14 | "footnote": { 15 | "start":"0.23530116023787565", 16 | "end":"2.0193976413772767", 17 | "target":"video-footnote-container", 18 | "text":"I invented JSON" 19 | } 20 | }, 21 | { 22 | "googlemap": { 23 | "start":"0.09096385771969716", 24 | "end":"8.617349362660605", 25 | "target":"video-map-container", 26 | "type":"ROADMAP", 27 | "lat":37.7749295, 28 | "lng":-122.4194155, 29 | "location":"San Francisco, CA" 30 | } 31 | }, 32 | { 33 | "webpage": { 34 | "start":"2.073975956009095", 35 | "end":"10.278915922325776", 36 | "target":"video-iframe-container", 37 | "src":"http://jslint.org" 38 | } 39 | }, 40 | { 41 | "footnote": { 42 | "start":2.145542172351516, 43 | "end":10.145542172351513, 44 | "target":"video-footnote-container", 45 | "text":"I wrote JSLint" 46 | } 47 | } 48 | ] 49 | } 50 | -------------------------------------------------------------------------------- /parsers/parserJSON/popcorn.parserJSON.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn 1.0 JSON parser Plug-in Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

            Popcorn 1.0 JSON parser Plug-in Demo

            17 |

            18 |
            19 | 35 |
            36 | 37 | 43 |
            44 |
            45 |
            46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /parsers/parserJSON/popcorn.parserJSON.js: -------------------------------------------------------------------------------- 1 | // PARSER: 0.3 JSON 2 | 3 | (function (Popcorn) { 4 | Popcorn.parser( "parseJSON", "JSON", function( data ) { 5 | 6 | // declare needed variables 7 | var retObj = { 8 | title: "", 9 | remote: "", 10 | data: [] 11 | }, 12 | manifestData = {}, 13 | dataObj = data; 14 | 15 | 16 | /* 17 | TODO: add support for filling in source children of the video element 18 | 19 | 20 | remote: [ 21 | { 22 | src: "whatever.mp4", 23 | type: 'video/mp4; codecs="avc1, mp4a"' 24 | }, 25 | { 26 | src: "whatever.ogv", 27 | type: 'video/ogg; codecs="theora, vorbis"' 28 | } 29 | ] 30 | 31 | */ 32 | 33 | 34 | Popcorn.forEach( dataObj.data, function ( obj, key ) { 35 | retObj.data.push( obj ); 36 | }); 37 | 38 | return retObj; 39 | }); 40 | 41 | })( Popcorn ); 42 | -------------------------------------------------------------------------------- /parsers/parserSBV/data/data.sbv: -------------------------------------------------------------------------------- 1 | 0:00:02.400,0:00:07.200 2 | Senator, we're making our final approach into Coruscant. 3 | 4 | 0:00:09.712,0:00:13.399 5 | Very good, Lieutenant. 6 | 7 | 0:00:15.042,0:00:18.042 8 | It's a trap! 9 | -------------------------------------------------------------------------------- /parsers/parserSBV/popcorn.parserSBV.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn 1.0 SBV parser Plug-in Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 19 | 20 | 21 |

            Popcorn 1.0 SBV parser Plug-in Demo

            22 | 23 |

            From 2.4 to 7.2 seconds, "Senator, we're making our final approach into Coruscant." is shown 24 |
            From 9.712 to 13.399 seconds, "Very good, Lieutenant." is shown 25 |
            From 15.042 to 18.042 seconds, "It's a trap!" is shown

            26 | 27 |
            28 | 44 |
            45 | 46 |

            Subtitle Source

            47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /parsers/parserSBV/popcorn.parserSBV.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn SBV parser Plug-in Test 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |

            Popcorn 0.3 SBV parser Plug-in Test

            23 |

            24 |
            25 |

            26 |
              27 |
              28 | 29 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /parsers/parserSBV/popcorn.parserSBV.unit.js: -------------------------------------------------------------------------------- 1 | asyncTest( "Popcorn 0.3 SBV Parser Plugin", function () { 2 | 3 | var count = 0, 4 | numSubs = 0, 5 | sub, 6 | poppercorn = Popcorn( "#video" ), 7 | subs = [ 8 | { 9 | text: "Senator, we're making our final approach into Coruscant.", 10 | start: 2.4, 11 | end: 7.2 12 | }, 13 | { 14 | text: "Very good, Lieutenant.", 15 | start: 9.712, 16 | end: 13.399 17 | }, 18 | { 19 | text: "It's a trap!", 20 | start: 15.042, 21 | end: 18.042 22 | } 23 | ], 24 | expects = subs.length * 3 + 1; 25 | 26 | function plus() { 27 | if ( ++count === expects ) { 28 | start(); 29 | } 30 | } 31 | 32 | poppercorn.parseSBV( "data/data.sbv", function (){ 33 | expect(expects); 34 | 35 | Popcorn.forEach( poppercorn.getTrackEvents(), function( evt ) { 36 | if( evt._natives.type === "subtitle" ) { 37 | sub = subs[ numSubs++ ]; 38 | 39 | equal( evt.start, sub.start, "Correctly parsed start of " + evt.start ); 40 | plus(); 41 | equal( evt.text, sub.text, "Correctly parsed text of " + evt.start ); 42 | plus(); 43 | equal( evt.end, sub.end, "Correctly parsed end at " + evt.start ); 44 | plus(); 45 | } 46 | }); 47 | 48 | equal( subs.length, numSubs, "Parsed all subtitles" ); 49 | plus(); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /parsers/parserSRT/data/data.srt: -------------------------------------------------------------------------------- 1 | 1 2 | 00:00:02.400 --> 00:00:05.200 3 | [Background Music Playing] 4 | 5 | 2 6 | 00:00:06.000 --> 00:00:13,700 7 | To say that 2 is greater than three (3 > 2) would be lying 8 | 9 | 3 10 | 00:00:15,712 --> 00:00:17,399 X1:000 X2:000 Y1:050 Y2:100 11 | Oh my god, Watch out! 12 | It's coming!! 13 | 14 | 4 15 | 00:00:25,712 --> 00:00:30,399 16 | [Bird noises] 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /parsers/parserSRT/data/unit.srt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 00:00:02.400 --> 00:00:05.200 5 | [Background Music Playing] 6 | 7 | 2 8 | 00:00:15,712 --> 00:00:17,399 X1:000 X2:000 Y1:050 Y2:100 9 | Oh my god, Watch out! 10 | It's coming!! 11 | 12 | 3 13 | 00:00:25,712 --> 00:00:30,399 14 | [Bird noises] 15 | 16 | 4 17 | 00:00:31,000 --> 00:00:31,999 18 | This text is RED and has not been {\pos(142,120)}positioned. 19 | 20 | 5 21 | 00:00:32,000 --> 00:00:32,999 22 | This is a\nnew line, as is\Nthis 23 | 24 | 6 25 | 00:00:33,000 --> 00:00:33,999 26 | This contains nested bold, italic, underline and strike-through HTML tags 27 | 28 | 7 29 | 00:00:34,000 --> 00:00:34,999 30 | Unclosed but supported HTML tags are left in, {\i1} SSA italics aren't 31 | 32 | 8 33 | 00:00:35,000 --> 00:00:35,999 34 | Unsupported HTML tags are escaped and left in, even if not closed. 35 | 36 | 9 37 | 00:00:36,000 --> 00:00:36,999 38 | Multiple {\pos(142,120)\b1}SSA tags are stripped 39 | 40 | 10 41 | 00:00:37,000 --> 00:00:37,999 42 | Greater than (<) and less than (>) are shown 43 | 44 | 45 | -------------------------------------------------------------------------------- /parsers/parserSRT/popcorn.parserSRT.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn 1.0 SRT parser Plug-in Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 19 | 20 | 21 |

              Popcorn 1.0 SRT parser Plug-in Demo

              22 | 23 |

              From 2.4 to 5.2 seconds, "[Background Music Playing]" is shown 24 |
              From 6 to 13.7 seconds, "<true> To say that 2 is greater than three (3 > 2) would be lying<true>" is shown 25 |
              From 15.712 to 17.399 seconds, "Oh my god, Watch out! It's coming!!" is shown 26 |
              From 25.712 to 30.399 seconds, "[Bird noises]" is shown

              27 | 28 |
              29 | 45 |
              46 | 47 |

              Subtitle Source

              48 | 49 | 50 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /parsers/parserSRT/popcorn.parserSRT.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn SRT parser Plug-in Test 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |

              Popcorn 0.3 SRT parser Plug-in Test

              23 |

              24 |
              25 |

              26 |
                27 |
                28 | 29 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /parsers/parserSSA/data/data.ssa: -------------------------------------------------------------------------------- 1 | [Script Info] 2 | Title: Testing subtitles for the SSA Format 3 | 4 | [V4 Styles] 5 | Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding 6 | Style: Default,Arial,20,65535,65535,65535,-2147483640,-1,0,1,3,0,2,30,30,30,0,0 7 | Style: Titre_episode,Akbar,140,15724527,65535,65535,986895,-1,0,1,1,0,3,30,30,30,0,0 8 | Style: Wolf main,Wolf_Rain,56,15724527,15724527,15724527,4144959,0,0,1,1,2,2,5,5,30,0,0 9 | 10 | 11 | 12 | [Events] 13 | Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text 14 | Dialogue: 0,0:00:02.40,0:00:07.20,Default,,0000,0000,0000,,Senator, {\kf89}we're \Nmaking our final \napproach into Coruscant. 15 | Dialogue: 0,0:00:09.71,0:00:13.39,Default,,0000,0000,0000,,{\pos(400,570)}Very good, Lieutenant. 16 | Dialogue: 0,0:00:15.04,0:00:18.04,Default,,0000,0000,0000,,It's \Na \ntrap! 17 | 18 | 19 | [Pictures] 20 | This section will be ignored 21 | 22 | [Fonts] 23 | This section will be ignored -------------------------------------------------------------------------------- /parsers/parserSSA/popcorn.parserSSA.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn 1.0 SSA parser Plug-in Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 19 | 20 | 21 |

                Popcorn 1.0 SSA parser Plug-in Demo

                22 | 23 |

                From 2.4 to 7.2 seconds, "Senator, we're making our final approach into Coruscant." is shown 24 |
                From 9.71 to 13.39 seconds, "Very good, Lieutenant." is shown 25 |
                From 15.04 to 18.04 seconds, "It's a trap!" is shown

                26 | 27 |
                28 | 44 |
                45 |

                Subtitle Source

                46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /parsers/parserSSA/popcorn.parserSSA.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn SSA parser Plug-in Test 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |

                Popcorn 0.3 SSA parser Plug-in Test

                23 |

                24 |
                25 |

                26 |
                  27 |
                  28 | 29 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /parsers/parserSSA/popcorn.parserSSA.unit.js: -------------------------------------------------------------------------------- 1 | asyncTest( "Popcorn 0.3 SSA/ASS Parser Plugin", function () { 2 | 3 | var count = 0, 4 | numSubs = 0, 5 | sub, 6 | poppercorn = Popcorn( "#video" ), 7 | subs = [ 8 | { 9 | text: "Senator, we're
                  making our final
                  approach into Coruscant.", 10 | start: 2.4, 11 | end: 7.2 12 | }, 13 | { 14 | text: "Very good, Lieutenant.", 15 | start: 9.71, 16 | end: 13.39 17 | }, 18 | { 19 | text: "It's
                  a
                  trap!", 20 | start: 15.04, 21 | end: 18.04 22 | } 23 | ], 24 | expects = subs.length * 3 + 1; 25 | 26 | function plus() { 27 | if ( ++count === expects ) { 28 | start(); 29 | } 30 | } 31 | 32 | poppercorn.parseSSA( "data/data.ssa", function() { 33 | 34 | Popcorn.forEach( poppercorn.getTrackEvents(), function( evt ) { 35 | if( evt._natives.type === "subtitle" ) { 36 | sub = subs[ numSubs++ ]; 37 | 38 | equal( evt.start, sub.start, "Correctly parsed start of " + evt.start ); 39 | plus(); 40 | equal( evt.text, sub.text, "Correctly parsed text of " + evt.start ); 41 | plus(); 42 | equal( evt.end, sub.end, "Correctly parsed end at " + evt.start ); 43 | plus(); 44 | } 45 | }); 46 | 47 | equal( subs.length, numSubs, "Parsed all subtitles" ); 48 | plus(); 49 | 50 | }); 51 | 52 | expect( expects ); 53 | 54 | }); 55 | -------------------------------------------------------------------------------- /parsers/parserTTML/popcorn.parserTTML.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn 1.0 TTML parser Plug-in Test 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |

                  Popcorn 1.0 TTML parser Plug-in Test

                  22 |

                  23 |
                  24 |

                  25 |
                    26 |
                    27 | 28 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /parsers/parserTTXT/data/data.TTXT: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 30 | 31 | 32 | 33 | 34 | 35 | 81 | 82 | 83 |

                    Butter Dependencies

                    84 | 85 |

                    Butter Popcorn Dependencies

                    86 |

                    87 |
                    88 |

                    89 |
                      90 |
                      91 |
                      92 | 95 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /test/data/jsonp.json: -------------------------------------------------------------------------------- 1 | jsonp({ "data": {"lang": "en", "length": 25} }); -------------------------------------------------------------------------------- /test/data/jsonp.php: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /test/data/jsonpfancyapi.php: -------------------------------------------------------------------------------- 1 | 16 | -------------------------------------------------------------------------------- /test/data/method.php: -------------------------------------------------------------------------------- 1 | sizeOf($_POST) ? "post" : "get" 6 | ) 7 | ); 8 | ?> 9 | -------------------------------------------------------------------------------- /test/data/remoteA.js: -------------------------------------------------------------------------------- 1 | Popcorn.AlphaLib = function() {}; -------------------------------------------------------------------------------- /test/data/remoteB.js: -------------------------------------------------------------------------------- 1 | Popcorn.BetaLib = function() {}; -------------------------------------------------------------------------------- /test/data/test.js: -------------------------------------------------------------------------------- 1 | { "data": {"lang": "en", "length": 25} } -------------------------------------------------------------------------------- /test/data/test.ttml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/data/test.txt: -------------------------------------------------------------------------------- 1 | This is a text test -------------------------------------------------------------------------------- /test/data/test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /test/data/testfunction.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | window.testFunction = function() {}; 3 | })(); -------------------------------------------------------------------------------- /test/data/testfunction2.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | window.testFunction2 = function() {}; 3 | })(); -------------------------------------------------------------------------------- /test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn Test Suite Runner 5 | 6 | 7 | 8 | 9 | 10 | 11 |

                      12 | Popcorn.js Test Suite 13 | 14 | | 15 | | 16 | | 17 | | 18 | | 19 | | 20 | 21 | 22 |

                      23 |

                      24 |

                      25 |
                        26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /test/italia.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/test/italia.mp4 -------------------------------------------------------------------------------- /test/italia.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/test/italia.ogg -------------------------------------------------------------------------------- /test/popcorn.inject.js: -------------------------------------------------------------------------------- 1 | (function( global ) { 2 | 3 | var combineFn = function( first, second ) { 4 | 5 | first = first || function() {}; 6 | second = second || function() {}; 7 | 8 | return function( message ) { 9 | first.call( this, message ); 10 | second.call( this, message ); 11 | }; 12 | }; 13 | 14 | if ( QUnit && global.parent ) { 15 | QUnit.done = combineFn( QUnit.done, function( message ) { 16 | global.parent.postMessage( JSON.stringify( message ), "*" ); 17 | }); 18 | QUnit.testDone = combineFn( QUnit.testDone, function( message ) { 19 | global.parent.postMessage( JSON.stringify( message ), "*" ); 20 | }); 21 | // Fail tests that don't complete in 60s 22 | QUnit.config.testTimeout = 60000; 23 | 24 | window.addEventListener( "message", function( e ) { 25 | if ( e.data === "getFocus" ) { 26 | window.focus(); 27 | } 28 | }, false ); 29 | } 30 | 31 | })( window ); 32 | -------------------------------------------------------------------------------- /test/popcorn.testrunner.css: -------------------------------------------------------------------------------- 1 | span#test-links { 2 | float: right; 3 | padding-right: 15px; 4 | } 5 | 6 | span#test-links > a { 7 | font-size: 0.8em; 8 | } 9 | 10 | input[type=checkbox], input#run-selected { 11 | position: relative; 12 | bottom: 3px; 13 | } 14 | 15 | input#run-selected { 16 | font-size: 16px; 17 | } -------------------------------------------------------------------------------- /test/popcorn.unit.archaic.js: -------------------------------------------------------------------------------- 1 | var methodsString = "removeInstance addInstance getInstanceById removeInstanceById " + 2 | "forEach extend effects error guid sizeOf isArray nop position disable enable destroy" + 3 | "addTrackEvent removeTrackEvent getTrackEvents getTrackEvent getLastTrackEventId " + 4 | "timeUpdate plugin removePlugin compose effect xhr getJSONP getScript"; 5 | 6 | module("Core"); 7 | test("Dummy", function () { 8 | 9 | expect( 1 ); 10 | 11 | ok( Popcorn, "Popcorn dummy exists"); 12 | }); 13 | 14 | test("isSupported", function () { 15 | 16 | expect( 2 ); 17 | 18 | ok( "isSupported" in Popcorn, "Popcorn.isSupported boolean flag exists"); 19 | ok( !Popcorn.isSupported, "Popcorn.isSupported boolean flag is false"); 20 | }); 21 | 22 | 23 | module("Static Methods"); 24 | (function() { 25 | 26 | var method, 27 | methods = methodsString.split( /\s+/ ); 28 | 29 | while( methods.length ) { 30 | 31 | method = methods.shift(); 32 | 33 | test( method, function () { 34 | 35 | expect( 1 ); 36 | 37 | ok( Popcorn[ method ], "Popcorn." + method + " exists"); 38 | }); 39 | } 40 | 41 | })( Popcorn ); 42 | 43 | 44 | module("Attempt"); 45 | (function() { 46 | 47 | var method, 48 | methods = methodsString.split( /\s+/ ); 49 | 50 | while( methods.length ) { 51 | 52 | method = methods.shift(); 53 | 54 | test( method, function () { 55 | 56 | expect( 1 ); 57 | 58 | equal( Popcorn[ method ](), undefined, "Popcorn." + method + "() dummy returns undefined without throwing exception"); 59 | 60 | }); 61 | } 62 | 63 | })( Popcorn ); 64 | 65 | -------------------------------------------------------------------------------- /test/popcorn.unit.archaic.setup.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | document.addEventListener = null; 4 | -------------------------------------------------------------------------------- /test/popcorn.unit.setup.js: -------------------------------------------------------------------------------- 1 | // .noConflict() setup 2 | var Popcorn = this.Popcorn || "Popcorn", 3 | pop = this.pop || "pop", 4 | originalPopcorn = Popcorn; 5 | 6 | (function( global ) { 7 | 8 | var Setup = {}; 9 | 10 | Setup.eventset = "loadstart progress suspend emptied stalled play pause " + 11 | "loadedmetadata loadeddata waiting playing canplay canplaythrough " + 12 | "seeking seeked timeupdate ended ratechange durationchange volumechange"; 13 | 14 | Setup.events = Setup.eventset.split(/\s+/g); 15 | 16 | global.Setup = Setup; 17 | 18 | })( window ); 19 | -------------------------------------------------------------------------------- /test/poster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/test/poster.png -------------------------------------------------------------------------------- /test/ready.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn API 5 | 6 | 7 | 31 | 32 | 33 | 86 | 87 | 88 | 89 |

                        Popcorn(/* DOM Ready */)

                        90 | 91 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /test/silence.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/test/silence.mp3 -------------------------------------------------------------------------------- /test/trailer.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/test/trailer.mp4 -------------------------------------------------------------------------------- /test/trailer.ogv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/test/trailer.ogv -------------------------------------------------------------------------------- /test/trailer.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mozilla/popcorn-js/95162da9c4de6f7a1e200242c5ab7cc556b55f1a/test/trailer.webm -------------------------------------------------------------------------------- /tools/cleaner.js: -------------------------------------------------------------------------------- 1 | // Swap escaped bits in code. See jsshellhelper.py for creation of __escaped_string 2 | function __unescape_string() { 3 | return __escaped_string.replace(/@DQUOTE@/g, '"'). 4 | replace(/@SQUOTE@/g, "'"). 5 | replace(/@NEWLINE@/g, '\n'). 6 | replace(/@BACKSLASH@/g, '\\'); 7 | } 8 | -------------------------------------------------------------------------------- /tools/jslint.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys, os, os.path, signal 3 | import jsshellhelper 4 | from optparse import OptionParser 5 | from subprocess import Popen, PIPE, STDOUT 6 | 7 | # Uses jsshell https://developer.mozilla.org/en/Introduction_to_the_JavaScript_shell 8 | 9 | class Linter(object): 10 | toolsdir = os.path.dirname(os.path.abspath(__file__)) 11 | 12 | def run(self, jsshell, filename): 13 | tmpFile = jsshellhelper.createEscapedFile(filename) 14 | 15 | cmd = [jsshell, 16 | '-f', os.path.join(self.toolsdir, 'cleaner.js'), 17 | '-f', tmpFile, 18 | '-e', 'var input = __unescape_string();\n', 19 | '-f', os.path.join(self.toolsdir, 'jslint-cmdline.js')] 20 | 21 | proc = Popen(cmd) 22 | stdout, stderr = proc.communicate() 23 | 24 | if stdout: 25 | print stdout 26 | else: 27 | print stderr 28 | 29 | jsshellhelper.cleanUp(tmpFile) 30 | 31 | 32 | def main(): 33 | parser = OptionParser() 34 | options, args = parser.parse_args() 35 | 36 | if len(args) < 2: 37 | print >>sys.stderr, """Usage: %s """ % sys.argv[0] 38 | sys.exit(1) 39 | 40 | linter = Linter() 41 | linter.run(args[0], args[1]) 42 | 43 | if __name__ == '__main__': 44 | main() 45 | -------------------------------------------------------------------------------- /tools/jsshellhelper.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os, os.path 3 | import tempfile 4 | 5 | # Uses jsshell https://developer.mozilla.org/en/Introduction_to_the_JavaScript_shell 6 | 7 | def createEscapedFile(filename): 8 | """ Stringifies a file (.js, .pde) and sticks it tmp file as an escaped js string with variable __escaped_string """ 9 | filepath = os.path.abspath(filename) 10 | es = 'var __escaped_string ="' 11 | f = open(filepath, "r"); 12 | for line in f: 13 | es += line.rstrip('\r\n').replace('"', '@DQUOTE@').replace("'", '@SQUOTE@').replace("\\", "@BACKSLASH@") + "@NEWLINE@" 14 | f.close() 15 | es += '";\n' 16 | 17 | # write the escaped string out to a tmp file, return the filename 18 | tmp = tempfile.mkstemp() 19 | os.close(tmp[0]) 20 | 21 | t = open(tmp[1], 'w') 22 | t.write(es) 23 | t.close() 24 | 25 | return tmp[1] 26 | 27 | def cleanUp(filepath): 28 | os.remove(filepath) 29 | -------------------------------------------------------------------------------- /unsupported/attribution/popcorn.attribution.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn attribution Plug-in Demo 5 | 6 | 7 | 8 | 34 | 35 | 36 |

                        Popcorn Attribution Plug-in Demo

                        37 |

                        A attribution displaying 'A Shared Culture, Jesse Dylan, license: CC-BY-N6' will appear at 0 seconds and disappear at 10 seconds.

                        38 |

                        A attribution displaying 'Internet, The Computer Chronicles' will appear at 5 seconds and disappear at 15 seconds.

                        39 |
                        40 | 56 |
                        57 |
                        58 |
                        59 | 60 | 61 | -------------------------------------------------------------------------------- /unsupported/attribution/popcorn.attribution.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn Attribution Plugin 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |

                        Popcorn Attribution Plugin

                        22 |

                        23 |
                        24 |

                        25 |
                          26 |
                          27 | 28 | 48 |
                          49 | 50 | 51 | -------------------------------------------------------------------------------- /unsupported/facebook/popcorn.facebook.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn Facebook Plug-in Test 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |

                          Popcorn Facebook Plugin

                          19 |

                          20 |
                          21 |

                          22 |
                            23 |
                            24 | 25 |
                            26 |
                            27 |
                            28 |
                            29 |
                            30 | 49 |
                            50 |
                            51 |
                            52 |
                            53 | 54 | 55 | -------------------------------------------------------------------------------- /unsupported/gml/popcorn.gml.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn Grafiti Markup Language Plug-in Demo 5 | 6 | 7 | 33 | 34 | 35 |

                            Popcorn GML Plug-in Demo

                            36 |

                            A Processing canvas displaying the GML tag 29582 will appear at 0-5 seconds.

                            37 |

                            A Processing canvas displaying the GML tag 155 will appear at 10-20 seconds.

                            38 |

                            A Processing canvas displaying the GML tag 161 will appear at 20-40 seconds.

                            39 |
                            40 | 56 |
                            57 |
                            58 | 59 | 60 | -------------------------------------------------------------------------------- /unsupported/gml/popcorn.gml.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn GML Plugin 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |

                            Popcorn GML Plugin

                            19 |

                            20 |
                            21 |

                            22 |
                              23 |
                              24 | 25 | 45 |
                              46 | 47 | 48 | -------------------------------------------------------------------------------- /unsupported/gml/popcorn.gml.unit.js: -------------------------------------------------------------------------------- 1 | asyncTest( "Popcorn GML Plugin", function() { 2 | 3 | var popped = Popcorn( "#video" ), 4 | expects = 8, 5 | count = 0, 6 | setupId, 7 | gmldiv = document.getElementById( "gmldiv" ); 8 | 9 | expect( expects ); 10 | 11 | function plus() { 12 | if ( ++count === expects ) { 13 | start(); 14 | } 15 | } 16 | 17 | ok( "gml" in popped, "gml is a method of the popped instance" ); 18 | plus(); 19 | 20 | equal( gmldiv.childElementCount, 0, "initially, there is nothing inside the gmldiv" ); 21 | plus(); 22 | 23 | popped.gml({ 24 | start: 0, 25 | end: 2, 26 | gmltag: "29582", 27 | target: "gmldiv" 28 | }) 29 | .gml({ 30 | start: 2, 31 | end: 4, 32 | gmltag: "155", 33 | target: "gmldiv" 34 | }).volume( 0 ); 35 | 36 | setupId = popped.getLastTrackEventId(); 37 | 38 | popped.exec( 0, function() { 39 | equal( gmldiv.children[ 0 ].style.display , "block", "first GML is visible on the page" ); 40 | plus(); 41 | }); 42 | 43 | popped.exec( 3, function() { 44 | equal( gmldiv.children[ 1 ].style.display, "block", "second GML is visible on the page" ); 45 | plus(); 46 | }); 47 | 48 | popped.exec( 4, function() { 49 | equal( gmldiv.children[ 1 ].style.display, "none", "second GML is no longer visible on the page" ); 50 | plus(); 51 | equal( gmldiv.children[ 0 ].style.display, "none", "first GML is no longer visible on the page" ); 52 | plus(); 53 | 54 | popped.pause().removeTrackEvent( setupId ); 55 | 56 | ok( !Processing.getInstanceById( "canvas155" ), "Processing insteance was properly destroyed" ); 57 | plus(); 58 | 59 | ok( !gmldiv.children[ 1 ], "canvas element was properly removed" ); 60 | plus(); 61 | }); 62 | 63 | popped.play(); 64 | 65 | }); 66 | -------------------------------------------------------------------------------- /unsupported/lastfm/popcorn.lastfm.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn API 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |

                              Popcorn LastFM Plugin

                              23 |

                              24 |
                              25 |

                              26 |
                                27 |
                                28 | 29 | 49 |
                                50 | 51 | 52 | -------------------------------------------------------------------------------- /unsupported/linkedin/popcorn.linkedin.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn LinkedIn Plugin Test 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |

                                Popcorn LinkedIn Plugin Test

                                19 |

                                20 |
                                21 |

                                22 |
                                  23 |
                                  24 | 25 | 45 |
                                  46 |
                                  47 |
                                  48 |
                                  49 |
                                  50 | 51 | 52 | -------------------------------------------------------------------------------- /unsupported/lowerthird/popcorn.lowerthird.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn Lower Third Plug-in Demo 5 | 6 | 7 | 8 | 9 | 30 | 31 | 32 |

                                  Popcorn Lower Third Plug-in Demo

                                  33 |

                                  At 5 seconds info will appear in the lower third of the video and disappear at 15 seconds.

                                  34 |

                                  At 20 seconds info will appear in the lower third of the video and disappear at 45 seconds.

                                  35 |
                                  36 | 37 | 52 |
                                  53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /unsupported/lowerthird/popcorn.lowerthird.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn Lower Third Plug-in Test 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

                                  Popcorn Lower Third Plugin

                                  21 |

                                  22 |
                                  23 |

                                  24 |
                                    25 |
                                    26 | 27 | 47 |
                                    48 | 49 | 50 | -------------------------------------------------------------------------------- /unsupported/lowerthird/popcorn.lowerthird.unit.js: -------------------------------------------------------------------------------- 1 | test( "Popcorn lower third Plugin", function() { 2 | 3 | var popped = Popcorn( "#video" ), 4 | expects = 7, 5 | count = 0, 6 | lowerthirddiv = document.getElementById( "lowerthirddiv" ); 7 | 8 | expect( expects ); 9 | 10 | function plus() { 11 | if ( ++count === expects ) { 12 | start(); 13 | } 14 | } 15 | 16 | stop(); 17 | 18 | ok( "lowerthird" in popped, "lowerthird is a method of the popped instance" ); 19 | plus(); 20 | 21 | equal( lowerthirddiv.innerHTML, "", "initially, there is nothing inside the lowerthirddiv" ); 22 | plus(); 23 | 24 | ok( !popped.container, "initially, there is no default div" ); 25 | plus(); 26 | 27 | // empty track events should be safe 28 | Popcorn.plugin.debug = true; 29 | popped.lowerthird({}); 30 | 31 | popped.lowerthird({ 32 | start: 0, 33 | end: 2, 34 | salutation: "Mr", 35 | name: "Hyde", 36 | role: "Monster" 37 | }) 38 | .lowerthird({ 39 | start: 2, 40 | end: 4, 41 | target: "lowerthirddiv", 42 | salutation: "Dr", 43 | name: "Jekyll", 44 | role: "Person" 45 | }) 46 | .volume( 0 ); 47 | 48 | popped.exec( 1, function() { 49 | equal( popped.container.innerHTML, "Mr Hyde
                                    Monster", "first lowerthird is visible" ); 50 | plus(); 51 | }); 52 | 53 | popped.exec( 3, function() { 54 | equal( lowerthirddiv.innerHTML, "
                                    Dr Jekyll
                                    Person
                                    ", "second lowerthird is visible" ); 55 | plus(); 56 | }); 57 | 58 | popped.exec( 5, function() { 59 | equal( popped.container.innerHTML, "", "first lowerthird is empty" ); 60 | plus(); 61 | equal( lowerthirddiv.innerHTML, "
                                    ", "second lowerthird is empty" ); 62 | plus(); 63 | }); 64 | 65 | popped.play(); 66 | 67 | }); 68 | -------------------------------------------------------------------------------- /unsupported/processing/popcorn.processing.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn processing Plug-in Simple Demo 5 | 6 | 7 | 8 | 44 | 45 | 46 |

                                    Popcorn processing Plug-in Simple Demo

                                    47 | 48 |
                                    49 | 65 |
                                    66 |
                                    67 |
                                    68 |
                                    69 |
                                    70 | 71 | -------------------------------------------------------------------------------- /unsupported/processing/popcorn.processing.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn processing unit Tests 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

                                    Popcorn processing Plug-in Demo

                                    16 |

                                    17 |
                                    18 |

                                    19 |
                                      20 |
                                      21 |
                                      22 | 42 |
                                      43 |
                                      44 |
                                      45 |
                                      46 |
                                      47 | 48 | -------------------------------------------------------------------------------- /unsupported/processing/test2.pjs: -------------------------------------------------------------------------------- 1 | // All Examples Written by Casey Reas and Ben Fry 2 | // unless otherwise stated. 3 | // for puff head 4 | float headX; 5 | float headY; 6 | float speedX = .7; 7 | float speedY = .9; 8 | 9 | // for puff body 10 | int cells = 1000; 11 | float[]px= new float[cells]; 12 | float[]py= new float[cells]; 13 | float[]radiiX = new float[cells]; 14 | float[]radiiY = new float[cells]; 15 | float[]angle = new float[cells]; 16 | float[]frequency = new float[cells]; 17 | float[]cellRadius = new float[cells]; 18 | 19 | void setup(){ 20 | 21 | size(200, 200); 22 | // begin in the center 23 | headX = width/2; 24 | headY = height/2; 25 | 26 | //fill body arrays 27 | for (int i=0; i< cells; i++){ 28 | radiiX[i] = random(-7, 7); 29 | radiiY[i] = random(-4, 4); 30 | frequency[i]= random(-9, 9); 31 | cellRadius[i] = random(16, 30); 32 | } 33 | frameRate(15); 34 | noLoop(); 35 | } 36 | 37 | void draw(){ 38 | background(0); 39 | noStroke(); 40 | fill(255, 255, 255, 5); 41 | 42 | //follow the leader 43 | for (int i =0; i< cells; i++){ 44 | if (i==0){ 45 | px[i] = headX+sin(radians(angle[i]))*radiiX[i]; 46 | py[i] = headY+cos(radians(angle[i]))*radiiY[i]; 47 | } 48 | else{ 49 | px[i] = px[i-1]+cos(radians(angle[i]))*radiiX[i]; 50 | py[i] = py[i-1]+sin(radians(angle[i]))*radiiY[i]; 51 | 52 | //check collision of body 53 | if (px[i] >= width-cellRadius[i]/2 || px[i] <= cellRadius[i]/2){ 54 | radiiX[i]*=-1; 55 | cellRadius[i] = random(1, 40); 56 | frequency[i]= random(-13, 13); 57 | } 58 | if (py[i] >= height-cellRadius[i]/2 || py[i] <= cellRadius[i]/2){ 59 | radiiY[i]*=-1; 60 | cellRadius[i] = random(1, 40); 61 | frequency[i]= random(-9, 9); 62 | } 63 | } 64 | // draw puff 65 | ellipse(px[i], py[i], cellRadius[i], cellRadius[i]); 66 | // set speed of body 67 | angle[i]+=frequency[i]; 68 | } 69 | 70 | // set velocity of head 71 | headX+=speedX; 72 | headY+=speedY; 73 | 74 | //check boundary collision of head 75 | if (headX >= width-cellRadius[0]/2 || headX <=cellRadius[0]/2){ 76 | speedX*=-1; 77 | } 78 | if (headY >= height-cellRadius[0]/2 || headY <= cellRadius[0]/2){ 79 | speedY*=-1; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /unsupported/rdio/popcorn.rdio.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn API 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

                                      Popcorn Rdio Plugin

                                      17 |

                                      18 |
                                      19 |

                                      20 |
                                        21 |
                                        22 | 23 | 43 |
                                        44 |
                                        45 |
                                        46 | 47 | 48 | -------------------------------------------------------------------------------- /unsupported/tagthisperson/popcorn.tagthisperson.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn tagthisperson Plug-in Demo 5 | 6 | 7 | 8 | 37 | 38 | 39 |

                                        Popcorn tagthisperson Plug-in Demo

                                        40 |

                                        A tag displaying Mike will appear at 0 seconds and disappear at 15 seconds.

                                        41 |

                                        A separate tag displaying Anna Sob with an image and a URL attached will appear at 0 seconds and disappear at 10 seconds.

                                        42 |

                                        At 5 seconds Scott with a URL attached will be appended to this tag and disappear at 15 seconds.

                                        43 |
                                        44 | 60 |
                                        61 |
                                        62 | 63 |
                                        64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /unsupported/tagthisperson/popcorn.tagthisperson.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn tagthisperson test 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |

                                        Popcorn tagthisperson Plugin

                                        20 |

                                        21 |
                                        22 |

                                        23 |
                                          24 |
                                          25 | 26 | 46 |
                                          47 |
                                          48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /unsupported/tagthisperson/popcorn.tagthisperson.unit.js: -------------------------------------------------------------------------------- 1 | test( "Popcorn tagthisperson Plugin", function() { 2 | 3 | var popped = Popcorn( "#video" ), 4 | expects = 8, 5 | count = 0, 6 | tagdiv = document.getElementById( "tagdiv" ); 7 | tagdiv2 = document.getElementById( "tagdiv2" ); 8 | 9 | expect( expects ); 10 | 11 | function plus() { 12 | if ( ++count === expects ) { 13 | start(); 14 | } 15 | } 16 | 17 | stop(); 18 | 19 | ok( "tagthisperson" in popped, "tagthisperson is a method of the popped instance" ); 20 | plus(); 21 | 22 | equal( tagdiv.innerHTML, "", "initially, there is nothing inside the tagdiv" ); 23 | plus(); 24 | 25 | popped.tagthisperson({ 26 | start: 0, 27 | end: 1, 28 | person: "Anna Sob", 29 | image: "http://newshour.s3.amazonaws.com/photos%2Fspeeches%2Fguests%2FRichardNSmith_thumbnail.jpg", 30 | href: "http://annasob.wordpress.com", 31 | target: "tagdiv" 32 | }) 33 | .tagthisperson({ 34 | start: 1, 35 | end: 2, 36 | person: "Scott", 37 | href: "http://scottdowne.wordpress.com/", 38 | target: "tagdiv" 39 | }) 40 | .tagthisperson({ 41 | start: 1, 42 | end: 2, 43 | person: "Mike", 44 | target: "tagdiv2" 45 | }) 46 | .tagthisperson({ 47 | start: 1, 48 | end: 2, 49 | person: "Daniel", 50 | target: "tagdiv2" 51 | }) 52 | .volume( 0 ); 53 | 54 | popped.exec( 0, function() { 55 | equal( tagdiv.childElementCount, 2, "tagdiv now contains two child elements" ); 56 | plus(); 57 | equal( tagdiv.textContent.trim() , "Anna Sob" ,"tagdiv shows the first tag" ); 58 | plus(); 59 | }); 60 | 61 | popped.exec( 1, function() { 62 | equal( tagdiv.innerHTML.search( " 2 | 3 | 4 | Popcorn Tumblr Plug-in Test 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |

                                          Popcorn Tumblr Plugin

                                          19 |

                                          20 |
                                          21 |

                                          22 |
                                            23 |
                                            24 | 25 |
                                            26 |
                                            27 |
                                            28 |
                                            29 |
                                            30 | 49 |
                                            50 |
                                            51 |
                                            52 |
                                            53 |
                                            54 |
                                            55 | 56 | 57 | -------------------------------------------------------------------------------- /wrappers/html5/popcorn.HTMLMediaElement.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The HTMLVideoElement and HTMLAudioElement are wrapped media elements 3 | * that are created within a DIV, and forward their properties and methods 4 | * to a wrapped object. 5 | */ 6 | (function( Popcorn, document ) { 7 | 8 | function canPlaySrc( src ) { 9 | // We can't really know based on URL. 10 | return "maybe"; 11 | } 12 | 13 | function wrapMedia( id, mediaType ) { 14 | var parent = typeof id === "string" ? document.querySelector( id ) : id, 15 | media = document.createElement( mediaType ); 16 | 17 | parent.appendChild( media ); 18 | 19 | // Add the helper function _canPlaySrc so this works like other wrappers. 20 | media._canPlaySrc = canPlaySrc; 21 | 22 | return media; 23 | } 24 | 25 | Popcorn.HTMLVideoElement = function( id ) { 26 | return wrapMedia( id, "video" ); 27 | }; 28 | Popcorn.HTMLVideoElement._canPlaySrc = canPlaySrc; 29 | 30 | 31 | Popcorn.HTMLAudioElement = function( id ) { 32 | return wrapMedia( id, "audio" ); 33 | }; 34 | Popcorn.HTMLAudioElement._canPlaySrc = canPlaySrc; 35 | 36 | }( Popcorn, window.document )); 37 | -------------------------------------------------------------------------------- /wrappers/html5/popcorn.HTMLVideoElement.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn HTMLVideoElement Tests 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

                                            Popcorn HTMLVideoElement Tests

                                            17 |

                                            18 |
                                            19 |

                                            20 |
                                              21 |
                                              22 |
                                              23 |
                                              24 | 25 | 26 | -------------------------------------------------------------------------------- /wrappers/html5/popcorn.HTMLVideoElement.unit.js: -------------------------------------------------------------------------------- 1 | 2 | // Find a suitable video source for this browser. 3 | var videoSource = (function() { 4 | 5 | var v = document.createElement( "video" ), 6 | sources = [ 7 | { 8 | type: "video/webm", 9 | file: "../../test/trailer.webm" 10 | }, 11 | { 12 | type: "video/mp4", 13 | file: "../../test/trailer.mp4" 14 | }, 15 | { 16 | type: "video/ogg", 17 | file: "../../test/trailer.ogv" 18 | } 19 | ], 20 | source, 21 | sourcesLength = sources.length; 22 | 23 | while( sourcesLength-- ) { 24 | source = sources[ sourcesLength ]; 25 | if( v.canPlayType( source.type ) !== "" ) { 26 | return source; 27 | } 28 | } 29 | 30 | throw "No Supported Media Types found for this browser."; 31 | 32 | }()); 33 | 34 | 35 | var testData = { 36 | 37 | videoSrc: videoSource.file, 38 | videoType: videoSource.type, 39 | expectedDuration: 64.544, 40 | 41 | createMedia: function( id ) { 42 | return Popcorn.HTMLVideoElement( id ); 43 | } 44 | 45 | }; 46 | -------------------------------------------------------------------------------- /wrappers/jwplayer/popcorn.HTMLJWPlayerVideoElement.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn HTMLJWPlayerVideoElement Tests 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

                                              Popcorn HTMLJWPlayerVideoElement Tests

                                              17 |

                                              18 |
                                              19 |

                                              20 |
                                                21 |
                                                22 | 23 |
                                                24 |
                                                25 | 26 | 27 | -------------------------------------------------------------------------------- /wrappers/jwplayer/popcorn.HTMLJWPlayerVideoElement.unit.js: -------------------------------------------------------------------------------- 1 | 2 | var testData = { 3 | 4 | videoSrc: "../../test/trailer.mp4", 5 | expectedDuration: 64.544, 6 | 7 | createMedia: function( id ) { 8 | pop = Popcorn.HTMLJWPlayerVideoElement( id ); 9 | pop.autoplay = true; 10 | return pop; 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /wrappers/null/popcorn.HTMLNullVideoElement.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn HTMLNullVideoElement Tests 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

                                                Popcorn HTMLNullVideoElement Tests

                                                17 |

                                                18 |
                                                19 |

                                                20 |
                                                  21 |
                                                  22 |
                                                  23 |
                                                  24 | 25 | 26 | -------------------------------------------------------------------------------- /wrappers/null/popcorn.HTMLNullVideoElement.unit.js: -------------------------------------------------------------------------------- 1 | 2 | var testData = { 3 | 4 | videoSrc: "#t=,20", 5 | expectedDuration: 20, 6 | 7 | createMedia: function( id ) { 8 | return Popcorn.HTMLNullVideoElement( id ); 9 | }, 10 | 11 | playerSpecificSyncTests: function() { 12 | 13 | test( "Null Wrapper 01 - Null regex testing ", 4, function() { 14 | 15 | var video = testData.createMedia( "#video" ); 16 | 17 | video.src = "#t=,123.12"; 18 | ok( video.duration === 123.12 && video.currentTime === 0, "Correct duration and currentTime" ); 19 | 20 | video.src = "#t=0.5,123.12"; 21 | ok( video.duration === 123.12 && video.currentTime === 0.5, "Correct duration and currentTime" ); 22 | 23 | video.src = "#t=,123"; 24 | ok( video.duration === 123 && video.currentTime === 0, "Correct duration and currentTime" ); 25 | 26 | video.src = "#t=12.54,123"; 27 | ok( video.duration === 123 && video.currentTime === 12.54, "Correct duration and currentTime" ); 28 | 29 | }); 30 | 31 | asyncTest( "Null Wrapper 02 - Null playbackRate testing ", 1, function() { 32 | 33 | video = testData.createMedia( "#video" ); 34 | 35 | video.src = "#t=,9"; 36 | pop = Popcorn( video ); 37 | pop.playbackRate( -1 ); 38 | pop.play( 5 ); 39 | 40 | pop.cue( 2, function(){ 41 | ok( pop.playbackRate() === -1, "Correct playbackRate" ); 42 | start(); 43 | }); 44 | 45 | pop.cue( 6, function(){ 46 | ok( false, "Incorrect playbackRate" ); 47 | }); 48 | }); 49 | } 50 | 51 | }; 52 | -------------------------------------------------------------------------------- /wrappers/soundcloud/popcorn.HTMLSoundCloudAudioElement.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn HTMLSoundCloudAudioElement Tests 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

                                                  Popcorn HTMLSoundCloudAudioElement Tests

                                                  17 |

                                                  18 |
                                                  19 |

                                                  20 |
                                                    21 |
                                                    22 |
                                                    23 |
                                                    24 | 25 | 26 | -------------------------------------------------------------------------------- /wrappers/soundcloud/popcorn.HTMLSoundCloudAudioElement.unit.js: -------------------------------------------------------------------------------- 1 | 2 | var testData = { 3 | 4 | videoSrc: "http://soundcloud.com/corbanbrook/leaving-on-a-spaceship", 5 | expectedDuration: 242.22, 6 | 7 | createMedia: function( id ) { 8 | return Popcorn.HTMLSoundCloudAudioElement( id ); 9 | }, 10 | 11 | playerSpecificSyncTests: function() { 12 | 13 | // Testing the id property inherited from MediaElementProto 14 | test( "SoundCloud 01 - id property accessible on wrapper object", 1, function() { 15 | 16 | var video = testData.createMedia( "#video" ); 17 | 18 | ok( video.id, "id property on wrapper object isn't null" ); 19 | }); 20 | 21 | // Testing the style property inherited from MediaElementProto 22 | test( "SoundCloud 02 - style property accessible on wrapper object", 1, function() { 23 | 24 | var video = testData.createMedia( "#video" ); 25 | 26 | ok( video.style, "Style property on wrapper object isn't null" ); 27 | }); 28 | 29 | test( "SoundCloud 03 - canPlaySrc for HTTPS sources", 1, function() { 30 | var video = testData.createMedia( "#video" ); 31 | 32 | ok( video._canPlaySrc( "https://soundcloud.com/user9067901/tone-pad" ), "SoundCloud returns true for HTTPS sources." ); 33 | }); 34 | }, 35 | 36 | shortVideoSrc: "http://soundcloud.com/user9067901/tone-pad", 37 | shortExpectedDuration: 5 38 | 39 | }; 40 | -------------------------------------------------------------------------------- /wrappers/vimeo/popcorn.HTMLVimeoVideoElement.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn HTMLVimeoVideoElement Tests 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

                                                    Popcorn HTMLVimeoVideoElement Tests

                                                    17 |

                                                    18 |
                                                    19 |

                                                    20 |
                                                      21 |
                                                      22 | 23 |
                                                      24 |
                                                      25 | 26 | 27 | -------------------------------------------------------------------------------- /wrappers/vimeo/popcorn.HTMLVimeoVideoElement.unit.js: -------------------------------------------------------------------------------- 1 | 2 | var testData = { 3 | 4 | videoSrc: "http://vimeo.com/12235444", 5 | expectedDuration: 382.502, 6 | 7 | createMedia: function( id ) { 8 | return Popcorn.HTMLVimeoVideoElement( id ); 9 | }, 10 | 11 | // We need to test Vimeo's URL params, which not all 12 | // wrappers mimic. Do it as a set of tests specific 13 | // to Vimeo. 14 | playerSpecificAsyncTests: function() { 15 | 16 | asyncTest( "Vimeo 01 - autoplay, loop params", 4, function() { 17 | 18 | var video = testData.createMedia( "#video" ); 19 | 20 | video.addEventListener( "loadedmetadata", function onLoadedMetadata() { 21 | video.removeEventListener( "loadedmetadata", onLoadedMetadata, false ); 22 | equal( video.autoplay, true, "autoplay is set via param" ); 23 | equal( video.loop, true, "loop is set via param" ); 24 | start(); 25 | }, false); 26 | 27 | equal( video.autoplay, false, "autoplay is initially false" ); 28 | equal( video.loop, false, "loop is initially false" ); 29 | 30 | video.src = testData.videoSrc + "?autoplay=1&loop=1"; 31 | 32 | }); 33 | 34 | }, 35 | 36 | playerSpecificSyncTests: function() { 37 | 38 | // Testing the id property inherited from MediaElementProto 39 | test( "Vimeo 01 - id property accessible on wrapper object", 1, function() { 40 | 41 | var video = testData.createMedia( "#video" ); 42 | 43 | ok( video.id, "id property on wrapper object isn't null" ); 44 | }); 45 | 46 | // Testing the style property inherited from MediaElementProto 47 | test( "Vimeo 02 - style property accessible on wrapper object", 1, function() { 48 | 49 | var video = testData.createMedia( "#video" ); 50 | 51 | ok( video.style, "Style property on wrapper object isn't null" ); 52 | }); 53 | } 54 | 55 | }; 56 | 57 | // Vimeo tends to fail when the iframes live in the qunit-fixture 58 | // div. Simulate the same effect by deleting all iframes under #video 59 | // after each test ends. 60 | var qunitStart = start; 61 | start = function() { 62 | // Give the video time to finish loading so callbacks don't throw 63 | setTimeout( function() { 64 | qunitStart(); 65 | var video = document.querySelector( "#video" ); 66 | while( video.hasChildNodes() ) { 67 | video.removeChild( video.lastChild ); 68 | } 69 | }, 500 ); 70 | }; 71 | -------------------------------------------------------------------------------- /wrappers/youtube/popcorn.HTMLYouTubeVideoElement.unit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Popcorn HTMLYouTubeVideoElement Tests 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

                                                      Popcorn HTMLYouTubeVideoElement Tests

                                                      17 |

                                                      18 |
                                                      19 |

                                                      20 |
                                                        21 |
                                                        22 | 23 |
                                                        24 |
                                                        25 | 26 | 27 | --------------------------------------------------------------------------------