if (commandObject.running && (commandObject.params["in"] > t || commandObject.params["out"] < t)) {
commandObject.running = false;
commandObject.onOut();
+ commandObject.removeOverlay();
}
}
}
if (!commandObject.running && commandObject.params["in"] < t && commandObject.params["out"] > t) {
commandObject.running = true;
commandObject.onIn();
+ commandObject.displayOverlay();
}
}
}
}
};
+
+
////////////////////////////////////////////////////////////////////////////
// Command objects
////////////////////////////////////////////////////////////////////////////
this.onIn = function() {};
this.onOut = function() {};
this.preload = function() {};
+ this.displayOverlay = function() {};
+ this.removeOverlay = function() {};
this.id = name + VideoCommand.count++;
this.params["in"] = "0";
this.params["out"] = this.videoManager.videoElement.duration;
+
+ // Adds all attributes from the xml 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,
}
}
}
+
+ // Creates a div for all overlays to use
+ if (!VideoManager.overlayDiv) {
+ VideoManager.overlayDiv = document.createElement('div');
+ VideoManager.overlayDiv.setAttribute('style', 'position:absolute;top:20px;left:20px');
+ this.videoManager.videoElement.parentNode.appendChild(VideoManager.overlayDiv);
+ }
+
+ // Checks for a url of an image to overlay onto the video
+ if (this.params.overlay) {
+ this.image = document.createElement('img');
+ this.image.setAttribute('src', this.params.overlay);
+ this.image.setAttribute('style', 'display:none');
+ VideoManager.overlayDiv.appendChild(this.image);
+ this.displayOverlay = function() {
+ this.image.setAttribute('style', 'display:inline');
+ };
+ this.removeOverlay = function() {
+ this.image.setAttribute('style', 'display:none');
+ };
+ }
};
VideoCommand.count = 0;
};
////////////////////////////////////////////////////////////////////////////
- // FlickrCommand Command
+ // Flickr Command
////////////////////////////////////////////////////////////////////////////
var FlickrCommand = function(name, params, text, videoManager) {