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9l#Ns@kr9?6JRe>_|<7!CmG_OAOi$vpL&Gy)X9B>ShpI#
z8jcVQ;-iKjd8^iujnyouqi0RD3Q~1k?LRQ}6{iM)s>x{*T4~ppkwWqylHT3q0e5at
zN`uY~8WI8uo`LS5O`oR5rarb({{Znc
zzwnRiKy#w%L;l?4{{Z4^>SbpB@%+s=Gh^=`&W~#Q9)BtFt7y8ij&!X+eQhNF0OD#U
z(=`#-PrUqXr2ha4`onX7dA~YB@1MTknWycaVC6n$u#QNrV@V@;+-EB4RE|$$Rx70V
df=Tgyp_7yQzQ6U!E1S)G)Sc
+
+
+ I am one of the lead developers of
+ popcorn a JavaScript library that adds
+ timeline based data to any video.
+ I am going to show you what popcorn
+ can do. Right now all you see is me
+ talking on the screen you canât really
+ do anything but watch. Letâs make this
+ video more exciting. Let me add
+ some French subtitles. Popcorn uses
+ Google Translate to translate subtitles
+ to any language. You might be curious
+ to know that this video was filmed in
+ Toronto, Ontario. If you donât know
+ exactly where that is feel free to
+ pause this video and investigate the
+ map. Popcorn was built by five people,
+ there they are. We collaborated with
+ filmmakers and artists to ensure that
+ popcorn is easy to use. Let me show
+ you some other cool features. Keep in
+ mind that you can have any feature
+ appear and disappear at any time
+ during the video. Popcorn makes it
+ possible to pull data from twitter.
+ Letâs see what people are saying
+ about popcorn right now.
+ You can also showcase your work
+ by pulling data from a flicker account.
+ Here are some pictures I posted.
+ If you are not quite sure what
+ Flicker is take a second to read
+ about it on Wikipedia. To try
+ out popcorn visit our homepage,
+ it is displayed just below me.
+
+
+
+ some French subtitles. Popcorn uses
+ Google Translate to translate subtitles
+ to any language. You might be curious
+ to know that this video was filmed in
+ Toronto, Ontario. If you donât know
+ exactly where that is feel free to
+ pause this video and investigate the
+ map. Popcorn was built by five people,
+ there they are. We collaborated with
+ filmmakers and artists to ensure that
+ popcorn is easy to use. Let me show
+ you some other cool features. Keep in
+ mind that you can have any feature
+ appear and disappear at any time
+ during the video. Popcorn makes it
+ possible to pull data from twitter.
+ Letâs see what people are saying
+ about popcorn right now.
+ You can also showcase your work
+ by pulling data from a flicker account.
+ Here are some pictures I posted.
+ If you are not quite sure what
+ Flicker is take a second to read
+ about it on Wikipedia. To try
+ out popcorn visit our homepage,
+ it is displayed just below me.
+
+
+
+
+
+
+
+
+
+
diff --git a/demos/popcorn/xml/data.xml~ b/demos/popcorn/xml/data.xml~
new file mode 100755
index 0000000..c23ccaf
--- /dev/null
+++ b/demos/popcorn/xml/data.xml~
@@ -0,0 +1,76 @@
+
+
+
+ I am one of the lead developers of
+ popcorn a JavaScript library that adds
+ timeline based data to any video.
+ I am going to show you what popcorn
+ can do. Right now all you see is me
+ talking on the screen you canât really
+ do anything but watch. Letâs make this
+ video more exciting. Let me add
+ some French subtitles. Popcorn uses
+ Google Translate to translate subtitles
+ to any language. You might be curious
+ to know that this video was filmed in
+ Toronto, Ontario. If you donât know
+ exactly where that is feel free to
+ pause this video and investigate the
+ map. Popcorn was built by five people,
+ there they are. We collaborated with
+ filmmakers and artists to ensure that
+ popcorn is easy to use. Let me show
+ you some other cool features. Keep in
+ mind that you can have any feature
+ appear and disappear at any time
+ during the video. Popcorn makes it
+ possible to pull data from twitter.
+ Letâs see what people are saying
+ about popcorn right now.
+ You can also showcase your work
+ by pulling data from a flicker account.
+ Here are some pictures I posted.
+ If you are not quite sure what
+ Flicker is take a second to read
+ about it on Wikipedia. To try
+ out popcorn visit our homepage,
+ it is displayed just below me.
+
+
+
+ some French subtitles. Popcorn uses
+ Google Translate to translate subtitles
+ to any language. You might be curious
+ to know that this video was filmed in
+ Toronto, Ontario. If you donât know
+ exactly where that is feel free to
+ pause this video and investigate the
+ map. Popcorn was built by five people,
+ there they are. We collaborated with
+ filmmakers and artists to ensure that
+ popcorn is easy to use. Let me show
+ you some other cool features. Keep in
+ mind that you can have any feature
+ appear and disappear at any time
+ during the video. Popcorn makes it
+ possible to pull data from twitter.
+ Letâs see what people are saying
+ about popcorn right now.
+ You can also showcase your work
+ by pulling data from a flicker account.
+ Here are some pictures I posted.
+ If you are not quite sure what
+ Flicker is take a second to read
+ about it on Wikipedia. To try
+ out popcorn visit our homepage,
+ it is displayed just below me.
+
+
+
+
+
+
+
+
+
+
diff --git a/demos/semantic_video/index.html b/demos/semantic_video/index.html
new file mode 100644
index 0000000..c7088f9
--- /dev/null
+++ b/demos/semantic_video/index.html
@@ -0,0 +1,545 @@
+
+
+
+ HTML5 Video Demo Using popcorn.js
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
This demo was created by Scott Downe, Anna Sobiepanek, Daniel Hodgin, Nick Cammarata, and Brett Gaylor as part of Web Made Movies. To download the source code and find out how you can contribute, click on the Web Made Movies logo at the bottom of this page.
+
+
+ Are you having trouble getting this demo to play?
+ This video will only play in modern browsers, such as Firefox 3.5+ or Safari 3+. Unfortunately, Internet Explorer does not currently support open video codecs, so the won't work in that browser.
+
This demo was created by Scott Downe, Anna Sobiepanek, Daniel Hodgin, Nick Cammarata, and Brett Gaylor as part of Web Made Movies. To download the source code and find out how you can contribute, click on the Web Made Movies logo at the bottom of this page.
+
+
+ Are you having trouble getting this demo to play?
+ This video will only play in modern browsers, such as Firefox 3.5+ or Safari 3+. Unfortunately, Internet Explorer does not currently support open video codecs, so the won't work in that browser.
+
+
+
+
+
+
diff --git a/demos/semantic_video/xml/webMadeMovies.xml b/demos/semantic_video/xml/webMadeMovies.xml
new file mode 100644
index 0000000..17b8dae
--- /dev/null
+++ b/demos/semantic_video/xml/webMadeMovies.xml
@@ -0,0 +1,324 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Look around the page as info is updated!
+
+
+ This video made exclusively for drumbeat.org
+ Steve Song
+
+
+
+
+
+
+
+
+ Grassroots Mapping, Tungsten Monkey
+
+ Keyboard Cat
+
+ KeyBoard Cat, Charlie Schmidt
+
+
+ Jeffrey Warren
+ Grassroots Mapping, Tungsten Monkey
+ Village Telco Guy
+
+
+
+
+ Jeffrey Warren
+
+
+
+
+
+ Learn more about Grass Roots mapping at www.grassrootsmapping.org
+
+
+
+
+ Michael Adeyeye
+
+ Charlie Schmidt
+
+
+ Keyboard Cat
+ Charlie Schmidt
+
+ Jonathan Zittrain
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ NCSA guy
+ Computer Chronicles guy #1
+ Computer Chronicles guy #2
+ Computer Chronicles guy #3
+
+ Jonathan Zittrain
+
+ Read Zittrain's book 'The Future of the Internet â And How to Stop It'
+
+ Mona Kasra
+ Noah Workman
+
+ Wilken Sanches
+
+ Keechang Kim
+
+ Celine Celines
+
+
+
+
+
+
+
+
+
+ All right let's take a look and show me some
+ of the neat things you can do on the Internet
+ Have you ever wondered if there is a common thread
+ that exists between open source
+ phone hackers in South Africa,
+ adventurers using kites to map an oil spill,
+ and a video of a cat seen by tens of millions of people?
+ Well it's the Internet
+ the cat, the kite, and the phone hackers
+ would all be impossible without the Internet
+ an open network that lets anyone
+ participate without asking permission.
+ The Internet is what lets M.I.T student Jeffrey Warren
+ use kites to map an oil spill.
+ well wait a second why do we have to go all the way
+ into space to take pictures of things
+ that are right, literally right next to us, you know.
+ We can use simple tools like balloons or kites.
+ Have the camera taking pictures every five seconds
+ the idea is to get a lot of people involved
+ in producing maps and then share all of the information
+ like Wikipedia style you know?
+ The Internet is what allows Steve Song and his friends
+ to create a D.I.Y. phone network
+ called the Village Telco.
+ Everyone that has a device, that we call a mesh potato,
+ actually has a phone number
+ and can call anyone else on the mesh at no charge.
+ So taking open-source principles to a telephone company.
+ Everything is open, anyone can come and anyone can join
+ anyone can make contributions
+ and that's why I'm here.
+ The Internet is what allowed Charlie Schmidt
+ to film his cat on his keyboard
+ and the rest is history.
+ I remember having two profound thoughts back to back
+ and the first one was any pervert in his basement
+ can compete with NBC.
+ And then I thought, ohh I am that pervert in his basement.
+ It wasn't always this way
+ before the web our computers could only network
+ through a series of walled gardens, and we had to ask
+ permission to publish our content or create new services.
+ There were some big companies in there that thought
+ they would run the mainframes that we
+ might be mediating data through.
+ CompuServe, America Online, The Source,
+ MCI Mail,Prodigy.
+ if you go to CompuServe,
+ you'll get whatever CompuServe has put under its roof.
+ If you subscribe to AOL you'll get whatever AOL has.
+ Prodigy even has a twenty-one volume electronic
+ encyclopedia that's updated quarterly
+ including thirty messages.
+ Alright, Prodigy :D
+ No one really factored in that off in a quiet corner,
+ there were tinkerers doing foundational technologies
+ for networking,
+ and they had a certain freedom that the firms didn't have.
+ You didn't have to do a business development deal
+ with the owner of the Internet...
+ before you could put up a website.
+ So that's what allowed Tim Berners-Lee
+ to develop a protocol for an application,
+ that would just run on top of the Internet,
+ called the web.
+ And then he was like, OK world go to it.
+ Ordinary people are becoming electronic publishers.
+ They are putting up the things
+ that mean something to them
+ and they want to share it with the rest of the world.
+ Why is it better than CompuServe or Prodigy?
+ That anyone can put any servers on
+ and have it do anything they want.
+ In fact most browsers have the ability
+ for you to view that source code.
+ I can go in then and start changing it
+ myself for free. Ok great.
+ Listen thereâs even an encyclopedia
+ Awesome. All right.
+ We owe everything about the Internet
+ to the fact that its open.
+ And the hacker spirit that the people
+ who created it believed it.
+ But all that could change.
+ The way things are⦠are not the way
+ things will inevitably be.
+ The Internet itself is evolving
+ and can be pushed
+ in one direction or another.
+ And some futures are much better than others.
+ Itâs great to have the example of the World Wide Web.
+ Itâs great to have the example of Wikipedia.
+ Thereâs more where that came from.
+
+ And I help make a better Internet
+ By making things easier to use
+ At Web Made Movies
+ we want to build a better Internet
+ by making video more open.
+ The page your watching is a good example
+ Weâre going to keep exploring how video
+ can be more like the web.
+ And tell the story of some web heroes
+ along the way.
+ Explore our credits section to see
+ how you can get involved.
+
+
+ My name is Mona Kasra
+ and I'm building a better Internet
+
+
+ I make the Internet better
+ producing and sharing music
+ using Creative Commons
+
+
+
+
+
+
+
+
+
diff --git a/demos/semantic_video/xml/webMadeMovies.xml~ b/demos/semantic_video/xml/webMadeMovies.xml~
new file mode 100644
index 0000000..7059fcb
--- /dev/null
+++ b/demos/semantic_video/xml/webMadeMovies.xml~
@@ -0,0 +1,324 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Look around the page as info is updated!
+
+
+ This video made exclusively for drumbeat.org
+ Steve Song
+
+
+
+
+
+
+
+
+ Grassroots Mapping, Tungsten Monkey
+
+ Keyboard Cat
+
+ KeyBoard Cat, Charlie Schmidt
+
+
+ Jeffrey Warren
+ Grassroots Mapping, Tungsten Monkey
+ Village Telco Guy
+
+
+
+
+ Jeffrey Warren
+
+
+
+
+
+ Learn more about Grass Roots mapping at www.grassrootsmapping.org
+
+
+
+
+ Michael Adeyeye
+
+ Charlie Schmidt
+
+
+ Keyboard Cat
+ Charlie Schmidt
+
+ Jonathan Zittrain
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ NCSA guy
+ Computer Chronicles guy #1
+ Computer Chronicles guy #2
+ Computer Chronicles guy #3
+
+ Jonathan Zittrain
+
+ Read Zittrain's book 'The Future of the Internet â And How to Stop It'
+
+ Mona Kasra
+ Noah Workman
+
+ Wilken Sanches
+
+ Keechang Kim
+
+ Celine Celines
+
+
+
+
+
+
+
+
+
+ All right let's take a look and show me some
+ of the neat things you can do on the Internet
+ Have you ever wondered if there is a common thread
+ that exists between open source
+ phone hackers in South Africa,
+ adventurers using kites to map an oil spill,
+ and a video of a cat seen by tens of millions of people?
+ Well it's the Internet
+ the cat, the kite, and the phone hackers
+ would all be impossible without the Internet
+ an open network that lets anyone
+ participate without asking permission.
+ The Internet is what lets M.I.T student Jeffrey Warren
+ use kites to map an oil spill.
+ well wait a second why do we have to go all the way
+ into space to take pictures of things
+ that are right, literally right next to us, you know.
+ We can use simple tools like balloons or kites.
+ Have the camera taking pictures every five seconds
+ the idea is to get a lot of people involved
+ in producing maps and then share all of the information
+ like Wikipedia style you know?
+ The Internet is what allows Steve Song and his friends
+ to create a D.I.Y. phone network
+ called the Village Telco.
+ Everyone that has a device, that we call a mesh potato,
+ actually has a phone number
+ and can call anyone else on the mesh at no charge.
+ So taking open-source principles to a telephone company.
+ Everything is open, anyone can come and anyone can join
+ anyone can make contributions
+ and that's why I'm here.
+ The Internet is what allowed Charlie Schmidt
+ to film his cat on his keyboard
+ and the rest is history.
+ I remember having two profound thoughts back to back
+ and the first one was any pervert in his basement
+ can compete with NBC.
+ And then I thought, ohh I am that pervert in his basement.
+ It wasn't always this way
+ before the web our computers could only network
+ through a series of walled gardens, and we had to ask
+ permission to publish our content or create new services.
+ There were some big companies in there that thought
+ they would run the mainframes that we
+ might be mediating data through.
+ CompuServe, America Online, The Source,
+ MCI Mail,Prodigy.
+ if you go to CompuServe,
+ you'll get whatever CompuServe has put under its roof.
+ If you subscribe to AOL you'll get whatever AOL has.
+ Prodigy even has a twenty-one volume electronic
+ encyclopedia that's updated quarterly
+ including thirty messages.
+ Alright, Prodigy :D
+ No one really factored in that off in a quiet corner,
+ there were tinkerers doing foundational technologies
+ for networking,
+ and they had a certain freedom that the firms didn't have.
+ You didn't have to do a business development deal
+ with the owner of the Internet...
+ before you could put up a website.
+ So that's what allowed Tim Berners-Lee
+ to develop a protocol for an application,
+ that would just run on top of the Internet,
+ called the web.
+ And then he was like, OK world go to it.
+ Ordinary people are becoming electronic publishers.
+ They are putting up the things
+ that mean something to them
+ and they want to share it with the rest of the world.
+ Why is it better than CompuServe or Prodigy?
+ That anyone can put any servers on
+ and have it do anything they want.
+ In fact most browsers have the ability
+ for you to view that source code.
+ I can go in then and start changing it
+ myself for free. Ok great.
+ Listen thereâs even an encyclopedia
+ Awesome. All right.
+ We owe everything about the Internet
+ to the fact that its open.
+ And the hacker spirit that the people
+ who created it believed it.
+ But all that could change.
+ The way things are⦠are not the way
+ things will inevitably be.
+ The Internet itself is evolving
+ and can be pushed
+ in one direction or another.
+ And some futures are much better than others.
+ Itâs great to have the example of the World Wide Web.
+ Itâs great to have the example of Wikipedia.
+ Thereâs more where that came from.
+
+ And I help make a better Internet
+ By making things easier to use
+ At Web Made Movies
+ we want to build a better Internet
+ by making video more open.
+ The page your watching is a good example
+ Weâre going to keep exploring how video
+ can be more like the web.
+ And tell the story of some web heroes
+ along the way.
+ Explore our credits section to see
+ how you can get involved.
+
+
+ My name is Mona Kasra
+ and I'm building a better Internet
+
+
+ I make the Internet better
+ producing and sharing music
+ using Creative Commons
+
+
+
+
+
+
+
+
+
diff --git a/popcorn.js b/popcorn.js
index 63714c9..fa3c1c0 100644
--- a/popcorn.js
+++ b/popcorn.js
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
(function(global, document) {
// Cache refs to speed up calls to native utils
@@ -786,3 +787,1053 @@
global.Popcorn = Popcorn;
})(window, window.document);
+=======
+/*global google: false, $: false, TWTR: false, jQuery: false*/ // This global comment is read by jslint
+
+(function() {
+ function getScript(url, test, success) {
+ if (test === 'undefined') {
+ var script = document.createElement('script');
+ script.src = url;
+ var head = document.getElementsByTagName('head')[0],
+ done = false;
+ script.onload = script.onreadystatechange = function () {
+ if (!done && (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete')) {
+ done = true;
+ success();
+ }
+ };
+ head.appendChild(script);
+ } else {
+ success();
+ }
+ }
+
+ var popcorn = this.popcorn = {};
+
+ // The video manager manages a single video element, and all it's commands.
+ popcorn.VideoManager = function(videoElement) {
+ this.commandObjects = {};
+ this.manifestObjects = {};
+ this.videoElement = videoElement;
+ videoElement.videoManager = this;
+ popcorn.addInstance(this);
+ videoElement.setAttribute("ontimeupdate", "popcorn.update(this);");
+ };
+
+ popcorn.VideoManager.prototype.addCommand = function(command) {
+ this.commandObjects[command.id] = command;
+ };
+
+ popcorn.VideoManager.prototype.removeCommand = function(command) {
+ delete this.commandObjects[command.id];
+ };
+
+ popcorn.VideoManager.prototype.addManifestObject = function(manifestAttributes) {
+ var manifest = {},
+ manifestId = "";
+ for (var i = 0, pl = manifestAttributes.length; i < pl; i++) {
+ for (var j = 0, nl = manifestAttributes[i].length; j < nl; j++) {
+ var key = manifestAttributes[i].item(j).nodeName,
+ data = manifestAttributes[i].item(j).nodeValue;
+ if (key === "id") {
+ manifestId = data;
+ } else {
+ manifest[key] = data;
+ }
+ }
+ }
+ this.manifestObjects[manifestId] = manifest;
+ };
+
+ popcorn.VideoManager.prototype.removeManifestObject = function(itemId) {
+ delete this.manifestObjects[itemId];
+ };
+
+ popcorn.VideoManager.prototype.loaded = function() {};
+
+ var inactiveTarget = {};
+
+ // Update is called on the video every time it's time changes.
+ popcorn.update = function(vid) {
+ var t = vid.currentTime,
+ commandObject = {}; // Loops through all commands in the manager, preloading data, and calling onIn() or onOut().
+ for (var i in vid.videoManager.commandObjects) {
+ if (vid.videoManager.commandObjects.hasOwnProperty(i)) {
+ commandObject = vid.videoManager.commandObjects[i];
+ if (commandObject.running && (commandObject.params["in"] > t || commandObject.params["out"] < t)) {
+ commandObject.running = false;
+ if (inactiveTarget[commandObject.params.target] <= 0 || --inactiveTarget[commandObject.params.target] <= 0) {
+ $("#" + commandObject.params.target + " .inactive").fadeIn(500);
+ }
+ commandObject.onOut();
+ commandObject.extension.onOut();
+ }
+ }
+ }
+ for (var j in vid.videoManager.commandObjects) {
+ if (vid.videoManager.commandObjects.hasOwnProperty(j)) {
+ commandObject = vid.videoManager.commandObjects[j];
+ if (!commandObject.loaded && (commandObject.params["in"] - 5) < t && commandObject.params["out"] > t) {
+ commandObject.loaded = true;
+ commandObject.preload();
+ }
+ if (!commandObject.running && commandObject.params["in"] < t && commandObject.params["out"] > t) {
+ commandObject.running = true;
+
+ $("#" + commandObject.params.target + " .inactive").hide();
+ inactiveTarget[commandObject.params.target]++;
+
+ if (commandObject.params.target) {
+ $("#" + commandObject.params.target + " .overlay").show().fadeOut(500);
+ }
+ if (typeof commandObject.flash === "undefined") {
+ var section = $(commandObject.target).parents('section');
+ if (!section.hasClass('hover')) {
+ section.addClass('hover');
+ section.attr('hoveron', $('video')[0].currentTime);
+ }
+ }
+ commandObject.onIn();
+ commandObject.extension.onIn();
+ }
+ }
+ }
+ };
+
+ // Store VideoManager instances
+ popcorn.instances = [];
+ popcorn.instanceIds = {};
+ popcorn.addInstance = function(manager) {
+ if (typeof manager.videoElement.id === 'undefined' || !manager.videoElement.id.length) {
+ manager.videoElement.id = "__video" + popcorn.instances.length;
+ }
+ popcorn.instanceIds[manager.videoElement.id] = popcorn.instances.length;
+ popcorn.instances.push(manager);
+ };
+
+ popcorn.getInstanceById = function(name) {
+ return popcorn.instances[popcorn.instanceIds[name]];
+ };
+
+ popcorn.getInstance = function(index) {
+ return popcorn.instances[index];
+ };
+
+ // Simple function to convert 0:05 to 0.5 in seconds
+ // acceptable formats are HH:MM:SS:MM, MM:SS:MM, SS:MM, SS
+ var toSeconds = function(time) {
+ var t = time.split(":");
+ if (t.length === 1) {
+ return parseFloat(t[0], 10);
+ } else if (t.length === 2) {
+ return parseFloat(t[0], 10) + parseFloat(t[1] / 12, 10);
+ } else if (t.length === 3) {
+ return parseInt(t[0] * 60, 10) + parseFloat(t[1], 10) + parseFloat(t[2] / 12, 10);
+ } else if (t.length === 4) {
+ return parseInt(t[0] * 3600, 10) + parseInt(t[1] * 60, 10) + parseFloat(t[2], 10) + parseFloat(t[3] / 12, 10);
+ }
+ };
+
+ var offset = function(elem) {
+ if(!elem) elem = this;
+
+ var x = elem.offsetLeft;
+ var y = elem.offsetTop;
+
+ while (elem = elem.offsetParent) {
+ x += elem.offsetLeft;
+ y += elem.offsetTop;
+ }
+
+ return { left: x, top: y };
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Command objects
+ ////////////////////////////////////////////////////////////////////////////
+
+ // Base class for all commands, SubtitleCommand, MapCommand, etc.
+ popcorn.VideoCommand = function(name, params, text, videoManager) {
+ this.name = name;
+ this.params = {};
+ this.text = text;
+ this.videoManager = videoManager;
+ this.running = false;
+ this.loaded = false;
+ this.onIn = function() {};
+ this.onOut = function() {};
+ this.preload = function() {};
+ this.extension = {
+ onIn: function() {},
+ onOut: function() {}
+ };
+ this.id = name + popcorn.VideoCommand.count++;
+ this.params["in"] = "0";
+ this.params["out"] = this.videoManager.videoElement.duration;
+
+ // Adds all attributes from the xml/json tag into this.params
+ for (var i = 0, pl = params.length; i < pl; i++) {
+ for (var j = 0, nl = params[i].length; j < nl; j++) {
+ var key = params[i].item(j).nodeName,
+ data = params[i].item(j).nodeValue;
+ if (key === "start_time") {
+ key = "in";
+ } else if (key === "end_time") {
+ key = "out";
+ }
+ if (key === "in" || key === "out") {
+ this.params[key] = (typeof data === "number" ? data : toSeconds(data));
+ } else {
+ this.params[key] = data;
+ }
+ }
+ }
+
+ // Checkes for a resourceid and gets all the attributes from that resource
+ if (this.params.resourceid) {
+ for (var attributeName in this.videoManager.manifestObjects[this.params.resourceid]) {
+ if (this.videoManager.manifestObjects[this.params.resourceid].hasOwnProperty(attributeName)) {
+ this.params[attributeName] = this.videoManager.manifestObjects[this.params.resourceid][attributeName];
+ }
+ }
+ }
+
+ if (!inactiveTarget[this.params.target]) {
+ inactiveTarget[this.params.target] = 0;
+ }
+ };
+ popcorn.VideoCommand.count = 0;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Subtitle Command
+ ////////////////////////////////////////////////////////////////////////////
+
+ // Child commands. Uses onIn() and onOut() to do time based operations
+ popcorn.SubtitleCommand = function(name, params, text, videoManager) {
+ popcorn.VideoCommand.call(this, name, params, text, videoManager);
+
+ // Creates a div for all subtitles to use
+ if (!popcorn.SubtitleCommand.subDiv) {
+ popcorn.SubtitleCommand.subDiv = document.createElement('div');
+ popcorn.SubtitleCommand.subDiv.style.position = "absolute";
+ popcorn.SubtitleCommand.subDiv.style.color = "white";
+ popcorn.SubtitleCommand.subDiv.style.textShadow = "black 2px 2px 6px";
+ popcorn.SubtitleCommand.subDiv.style.fontSize = "18px";
+ popcorn.SubtitleCommand.subDiv.style.fontWeight = "bold";
+ popcorn.SubtitleCommand.subDiv.style.textAlign = "center";
+
+ this.videoManager.videoElement.parentNode.appendChild(popcorn.SubtitleCommand.subDiv);
+ }
+ if (this.params.target) {
+ this.target = document.getElementById(this.params.target);
+ } else {
+ this.target = popcorn.SubtitleCommand.subDiv;
+ }
+ this.target.style.display = "none";
+
+ this.onIn = function() {
+ if (this.params.languagesrc) {
+ var i = document.getElementById(this.params.languagesrc).selectedIndex,
+ that = this;
+ if (document.getElementById(this.params.languagesrc).options[i].value !== (this.params.language || "") ||
+ (this.params.accessibilitysrc && document.getElementById(this.params.accessibilitysrc).checked)) {
+ google.language.translate(this.text, '', document.getElementById(this.params.languagesrc).options[i].value, function(result) {
+ that.target.innerHTML = result.translation;
+ that.target.style.display = "inline";
+ popcorn.SubtitleCommand.subDiv.style.top = offset(videoManager.videoElement).top + videoManager.videoElement.offsetHeight - 64 + "px";
+ popcorn.SubtitleCommand.subDiv.style.left = offset(videoManager.videoElement).left + ((videoManager.videoElement.offsetWidth / 2) - (popcorn.SubtitleCommand.subDiv.offsetWidth / 2)) + "px";
+ });
+ }
+ } else {
+ this.target.innerHTML = this.text;
+ this.target.style.display = "inline";
+ popcorn.SubtitleCommand.subDiv.style.top = offset(videoManager.videoElement).top + videoManager.videoElement.offsetHeight - 64 + "px";
+ popcorn.SubtitleCommand.subDiv.style.left = offset(videoManager.videoElement).left + ((videoManager.videoElement.offsetWidth / 2) - (popcorn.SubtitleCommand.subDiv.offsetWidth / 2)) + "px";
+ }
+ };
+ this.onOut = function() {
+ this.target.innerHTML = "";
+ this.target.style.display = "none";
+ };
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Lower third text Command
+ ////////////////////////////////////////////////////////////////////////////
+
+ popcorn.LowerThirdCommand = function(name, params, text, videoManager) {
+ popcorn.VideoCommand.call(this, name, params, text, videoManager);
+
+ // Creates a div for all lower thirds
+ if (!popcorn.LowerThirdCommand.ltDiv) {
+ popcorn.LowerThirdCommand.ltDiv = document.createElement('div');
+ popcorn.LowerThirdCommand.ltDiv.setAttribute('style',
+ 'padding-left:40px;padding-right:40px;padding-top:40px;position:absolute;top:150px;left:1px;color:white;font-weight:bold;font-family:sans-serif;text-shadow:black 1px 1px 3px;font-size:22px;width:450px;');
+ this.videoManager.videoElement.parentNode.appendChild(popcorn.LowerThirdCommand.ltDiv);
+ }
+ if (this.params.target) {
+ this.target = document.getElementById(this.params.target);
+ } else {
+ this.target = popcorn.LowerThirdCommand.ltDiv;
+ }
+
+ this.onIn = function() {
+ $(this.target).css("text-align", (this.params.align || 'left'));
+ if (this.params.languagesrc) {
+ var i = document.getElementById(this.params.languagesrc).selectedIndex;
+ var that = this;
+ google.language.translate((this.params.salutation || ""), '', document.getElementById(this.params.languagesrc).options[i].value, function(result) {
+ var span = document.createElement('span');
+ span.innerHTML = result.translation + " ";
+ span.setAttribute('style', 'font-size:26px;');
+ that.target.appendChild(span);
+ });
+ google.language.translate((this.params.name || ""), '', document.getElementById(this.params.languagesrc).options[i].value, function(result) {
+ var span = document.createElement('span');
+ span.innerHTML = result.translation;
+ span.setAttribute('style', 'font-size:26px;');
+ that.target.appendChild(span);
+ });
+ google.language.translate((this.params.role || ""), '', document.getElementById(this.params.languagesrc).options[i].value, function(result) {
+ that.target.innerHTML += " " + result.translation;
+ });
+ } else {
+ var span = document.createElement('span');
+ span.innerHTML = (this.params.salutation || "") + " " + (this.params.name || "");
+ span.setAttribute('style', 'font-size:26px;');
+ this.target.appendChild(span);
+ this.target.innerHTML += " " + (this.params.role || "");
+ }
+ };
+ this.onOut = function() {
+ this.target.innerHTML = "";
+ };
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+ // GoogleNews Command
+ ////////////////////////////////////////////////////////////////////////////
+
+ popcorn.GoogleNewsCommand = function(name, params, text, videoManager) {
+ popcorn.VideoCommand.call(this, name, params, text, videoManager);
+ this.target = document.createElement('div');
+ this.target.setAttribute('style', 'display:none;border:0px;');
+ document.getElementById(this.params.target).appendChild(this.target);
+ this.target.setAttribute('id', this.id);
+ var content = document.getElementById(this.id);
+ var options = {
+ format : "300x250",
+ queryList : [
+ {q: this.params.topic || "Top Stories"}
+ ]
+ };
+ var newsShow = new google.elements.NewsShow(content, options);
+
+ this.onIn = function() {
+ this.target.setAttribute('style', 'display:inline');
+ $("a").each(function() {
+ this.setAttribute('target', '_blank');
+ });
+ document.getElementById(this.params.target).style.display = "inline";
+ };
+ this.onOut = function() {
+ this.target.setAttribute('style', 'display:none');
+ document.getElementById(this.params.target).style.display = "none";
+ };
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+ // TagThisPerson Command
+ ////////////////////////////////////////////////////////////////////////////
+
+ var people = function(){
+ this.contains = {};
+ this.toString = function() {
+ var r = [];
+ for (var i in this.contains) {
+ if (this.contains.hasOwnProperty(i)) {
+ r.push(" " + this.contains[i]);
+ }
+ }
+ return r.toString();
+ };
+ };
+ popcorn.TagCommand = function(name, params, text, videoManager) {
+ popcorn.VideoCommand.call(this, name, params, text, videoManager);
+
+ if (!popcorn.TagCommand[this.params.target]) {
+ popcorn.TagCommand[this.params.target] = new people();
+ }
+
+ this.onIn = function() {
+ popcorn.TagCommand[this.params.target].contains[this.text] = this.text;
+ document.getElementById(this.params.target).innerHTML = popcorn.TagCommand[this.params.target].toString();
+ };
+ this.onOut = function() {
+ delete popcorn.TagCommand[this.params.target].contains[this.text];
+ document.getElementById(this.params.target).innerHTML = popcorn.TagCommand[this.params.target].toString();
+ };
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Map Command
+ ////////////////////////////////////////////////////////////////////////////
+
+ popcorn.MapCommand = function(name, params, text, videoManager) {
+ popcorn.VideoCommand.call(this, name, params, text, videoManager);
+
+ // All data from Universal Subtitles comes from the text attribute
+ // so the data from that needs to enter the appropriate fields
+ if (typeof this.text === "string" && this.text !== "") {
+ // Universal Subtitles has no target attribute, so we create a default
+ this.params.target = "mapdiv";
+ var split = this.text.split(", ");
+ this.params.lat = split[0];
+ this.params.long = split[1];
+ this.params.zoom = split[2];
+ }
+ this.params.zoom = parseInt(this.params.zoom, 10);
+ // load the map
+ // http://code.google.com/apis/maps/documentation/javascript/reference.html#MapOptions <-- Map API
+ this.location = new google.maps.LatLng(this.params.lat, this.params.long);
+ if (!popcorn.MapCommand[this.params.target]) {
+ popcorn.MapCommand[this.params.target] = new google.maps.Map(document.getElementById(this.params.target), {mapTypeId: google.maps.MapTypeId.HYBRID});
+ popcorn.MapCommand[this.params.target].setCenter(new google.maps.LatLng(0, 0));
+ popcorn.MapCommand[this.params.target].setZoom(0);
+ }
+ this.onIn = function() {
+ popcorn.MapCommand[this.params.target].setCenter(this.location);
+ popcorn.MapCommand[this.params.target].setZoom(this.params.zoom);
+ if (this.params.src && this.params.mapinfo) {
+ var link = document.createElement("a");
+ link.setAttribute("href", this.params.src);
+ link.setAttribute("target", "_blank");
+ link.appendChild(document.createTextNode(this.params.description||this.params.src));
+ document.getElementById(this.params.mapinfo).appendChild(link);
+ }
+ };
+ this.onOut = function() {
+ popcorn.MapCommand[this.params.target].setCenter(new google.maps.LatLng(0, 0));
+ popcorn.MapCommand[this.params.target].setZoom(0);
+ if (this.params.mapinfo) {
+ document.getElementById(this.params.mapinfo).innerHTML = "";
+ }
+ };
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Lastfm Command
+ ////////////////////////////////////////////////////////////////////////////
+
+ popcorn.LastfmCommand = function(name, params, text, videoManager) {
+ popcorn.VideoCommand.call(this, name, params, text, videoManager);
+ // Setup a default, hidden div to hold the images
+ var target = document.createElement('div');
+ target.setAttribute('id', this.id);
+ document.getElementById(this.params.target).appendChild(target);
+ // Div is hidden by default
+ target.setAttribute('style', 'display:none');
+ var htmlString = '';
+
+ // This uses jquery
+ $.getJSON("http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist="+ this.params.artist +"&api_key=30ac38340e8be75f9268727cb4526b3d&format=json&callback=?",
+ function(data){
+ htmlString += '