Created
June 29, 2011 03:51
-
-
Save cgiffard/1053047 to your computer and use it in GitHub Desktop.
WebVTT Metadata JS API Idea
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
WEBVTT | |
Language=zh | |
Kind=Caption | |
Version=V1_ABC | |
License=CC-BY-SA | |
Description=An example file demonstrating JS access for WebVTT metadata | |
COMMENT --> | |
This file was patched together from WebVTT examples here: http://blog.gingertech.net/2011/06/27/recent-developments-around-webvtt/ | |
1 | |
00:00:15.000 --> 00:00:17.950 | |
first cue |
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
// Proposal 1 - key/value in the form of a raw object | |
// Property names are camel cased - "My Property Name" becomes "myPropertyName" ala CSS | |
// Get description of example track | |
document.getElementsByTagName("video")[0].tracks[0].metadata.description; | |
document.getElementsByTagName("video")[0].tracks[0].metadata["description"]; | |
// Mutation would be simple | |
document.getElementsByTagName("video")[0].tracks[0].metadata["description"] = "Here's a new description assigned by JS!"; | |
// Proposal 2 (more verbose, in line with DOM. Don't like this one anywhere near as much.) | |
var myVideo = document.getElementsByTagName("video")[0]; | |
// Get licence of example track | |
myVideo.tracks[0].metadata.getMetadataItem("licence"); | |
// This would also allow mutation | |
myVideo.tracks[0].metadata.setMetadataItem("licence","GPLv3"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment