Created
February 19, 2013 16:54
-
-
Save digitarald/4987688 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ('MozActivity' in window) { // feature detection | |
// When getting elements, like document.getElementsByClassName('video-links') | |
// rather use event delegation, like | |
// `jQuery(document).on('click', 'video', fn) | |
document.getElementById('video-1').onclick = function(evt) { | |
evt.preventDefault(); // Prevent click behaviour | |
console.log("Launching Video!"); | |
var activity = new MozActivity({ | |
name: "view", | |
data: { | |
type: "video/mp4", | |
url: 'http://www.archive.org/download/Mario1_507/Mario1_507_512kb.mp4' | |
} | |
}); | |
// Optional events (you can fire and forget) | |
activity.onsuccess = function() { | |
console.log("Video finished playing, want to react?"); | |
}; | |
activity.onerror = function() { | |
console.log("Video wasn't played, want to react?"); | |
}; | |
}; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment