--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Popcorn google Map Plug-in Demo</title>
+
+ <script src="../../popcorn.js"></script>
+ <script src="popcorn.googleMap.js"></script>
+ <script>
+ document.addEventListener('DOMContentLoaded', function () {
+ var p = Popcorn('#video')
+ .play()
+ .googleMap({
+ start: 15, // seconds
+ end: 50, // seconds
+ type: 'ROADMAP',
+ target: 'map',
+ lat: "29.2720",
+ long: "-90.0233"
+ } )
+
+ }, false);
+
+ </script>
+</head>
+<body>
+ <h1 id="qunit-header">Popcorn google Map Plug-in Demo</h1>
+ <p> A footnote displaying This video made exclusively for drumbeat.org' will appear at 5 seconds and disappear at 15 seconds.</p>
+ <p> A footnote displaying 'Visit webmademovies.org for more details' will appear at 20 seconds and disappear at 45 seconds.</p>
+ <div>
+ <video id='video'
+ controls preload='none'
+ width= '250px'
+ poster="../../test/poster.png">
+
+ <source id='mp4'
+ src="../../test/trailer.mp4"
+ type='video/mp4; codecs="avc1, mp4a"'>
+
+ <source id='ogv'
+ src="../../test/trailer.ogv"
+ type='video/ogg; codecs="theora, vorbis"'>
+
+ <p>Your user agent does not support the HTML5 Video element.</p>
+
+ </video>
+ </div>
+ <div id="map" width="50%" height="50%">
+ </div>
+</body>
+</html>
--- /dev/null
+// PLUGIN: Google Maps
+
+(function (Popcorn) {
+
+ /**
+ * googleMap popcorn plug-in
+ * Adds a map to the target div centered on the location specified
+ * by the user
+ * Options parameter will need a start, end, target, lat and long, zoom
+ * Start is the time that you want this plug-in to execute
+ * End is the time that you want this plug-in to stop executing
+ * Target is the id of the document element that the text needs to be
+ * Type either: HYBRID (default), ROADMAP, SATELLITE, TERRAIN
+ * attached to, this target element must exist on the DOM
+ * Src [optional]
+ * MapInfo [optional]
+ * Note:
+ * @param {Object} options
+ *
+ * Example:
+ var p = Popcorn('#video')
+ .googleMap({
+ start: 5, // seconds
+ end: 15, // seconds
+ type: 'ROADMAP',
+ target: 'map'
+ } )
+ *
+ */
+ Popcorn.plugin( "googleMap" , (function(){
+
+ var temp,head, script,location, map, link;
+
+ return {
+ _setup : function( event, options ) {
+ // check if google map api is already loaded
+ head = document.getElementsByTagName('head')[0];
+ script = document.createElement('script');
+ script.onload = function() {
+ alert("he");
+ location = new google.maps.LatLng(options.lat, options.long);
+ map = new google.maps.Map(document.getElementById(options.target), {mapTypeId: options.type | google.maps.MapTypeId.HYBRID });
+
+ }
+ script.src = "http://maps.google.com/maps/api/js?sensor=false";
+ script.type = 'text/javascript';
+ head.appendChild(script)
+ //head.insertBefore( script, head.firstChild );
+ // setup isready
+
+ },
+ /**
+ * @member webpage
+ * The start function will be executed when the currentTime
+ * of the video reaches the start time provided by the
+ * options variable
+ */
+ start: function(event, options){
+ temp = document.getElementById( options.target );
+ temp.innerHTML = options.text;
+
+ map.setCenter(location);
+ map.setZoom(options.zoom);
+ if (options.src && options.mapinfo) {
+ link = document.createElement("a");
+ link.setAttribute("href", options.src);
+ link.setAttribute("target", "_blank");
+ link.appendChild(document.createTextNode(options.description||options.src));
+ document.getElementById(options.mapinfo).appendChild(link);
+ }
+ },
+ /**
+ * @member webpage
+ * The end function will be executed when the currentTime
+ * of the video reaches the end time provided by the
+ * options variable
+ */
+ end: function(event, options){
+ //temp.innerHTML = "";
+ //figure out how to delete map
+ }
+
+ };
+
+ })());
+
+})( Popcorn );
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Popcorn API</title>
+ <link rel="stylesheet" href="../../test/qunit/qunit.css" type="text/css" media="screen">
+ <script src="../../test/qunit/qunit.js"></script>
+ <!--
+ do not move - this must be called immediately prior to
+ popcorn-api-draft.js
+ -->
+
+ <script src="../../popcorn.js"></script>
+ <script src="popcorn.googleMap.js"></script>
+
+ <script src="popcorn.googleMap.unit.js"></script>
+</head>
+<body>
+ <h1 id="qunit-header">Popcorn Google Map Plugin</h1>
+ <h2 id="qunit-banner"></h2>
+ <div id="qunit-testrunner-toolbar"></div>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture"> </div>
+
+ <video id='video'
+ controls preload='none'
+ width= '250px'
+ poster="../../test/poster.png">
+
+ <source id='mp4'
+ src="../../test/trailer.mp4"
+ type='video/mp4; codecs="avc1, mp4a"'>
+
+ <source id='ogv'
+ src="../../test/trailer.ogv"
+ type='video/ogg; codecs="theora, vorbis"'>
+
+ <p>Your user agent does not support the HTML5 Video element.</p>
+
+ </video>
+ <div id="map"></div>
+</body>
+</html>
--- /dev/null
+test("Popcorn Google Map Plugin", function () {
+
+ var popped = Popcorn("#video"),
+ expects = 5,
+ count = 0,
+ iframeInterval,
+ iframeInterval2,
+ iframeInterval3,
+ iframeInterval4;
+
+ expect(expects);
+
+ function plus() {
+ if ( ++count===expects) {
+ start();
+ }
+ }
+
+ stop();
+
+ ok ('footnote' in popped, "footnote is a mehtod of the popped instance");
+ plus();
+
+ ok ( document.getElementById('footnotediv').innerHTML === "", "initially, there is nothing inside the footnotediv" );
+ plus();
+ //equals( actual, expected, message ) instead of ok( boolean true, message )
+ popped.footnote({
+ start: 5, // seconds
+ end: 15, // seconds
+ text: 'This video made exclusively for drumbeat.org',
+ target: 'footnotediv'
+ } )
+ .footnote({
+ start: 35, // seconds
+ end: 45, // seconds
+ text: 'Visit webmademovies.org for more details',
+ target: 'footnotediv'
+ } )
+ .play();
+
+
+ interval = setInterval( function() {
+ if( popped.currentTime() > 5 && popped.currentTime() <= 15 ) {
+ ok (document.getElementById('footnotediv').innerHTML === "This video made exclusively for drumbeat.org", "footnote displaing correct information" );
+ plus();
+ clearInterval( interval );
+ }
+ }, 5000);
+
+ interval2 = setInterval( function() {
+ if( popped.currentTime() > 15 && popped.currentTime() < 35 ) {
+ ok (document.getElementById('footnotediv').innerHTML === "", "footnote cleared properly" );
+ plus();
+ clearInterval( interval2 );
+ }
+ }, 5000);
+
+ interval3 = setInterval( function() {
+ if( popped.currentTime() > 35 && popped.currentTime() < 45 ) {
+ ok (document.getElementById('footnotediv').innerHTML === "Visit webmademovies.org for more details", "footnote displaing correct information" );
+ plus();
+ clearInterval( interval3 );
+ }
+ }, 5000);
+
+});