Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Javascript that is needed for HTML files with the HTML5 media player. | 1 // Javascript that is needed for HTML files with the HTML5 media player. |
| 2 // It does the following: | 2 // It does the following: |
| 3 // * Parses query strings and sets the HTML tag. | 3 // * Parses query strings and sets the HTML tag. |
| 4 // * Installs event handlers to change the HTML title. | 4 // * Installs event handlers to change the HTML title. |
| 5 | 5 |
| 6 var player = null; | 6 var player = null; |
| 7 function InstallEventHandler(event, action) { | 7 function InstallEventHandler(event, action) { |
| 8 player.addEventListener(event, function(e) { | 8 player.addEventListener(event, function(e) { |
| 9 eval(action); | 9 eval(action); |
| 10 }, false); | 10 }, false); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 document.title = 'FAIL'; | 76 document.title = 'FAIL'; |
| 77 ok = false; | 77 ok = false; |
| 78 } | 78 } |
| 79 for (i = 0; i < original_actions.length / 3; i++) { | 79 for (i = 0; i < original_actions.length / 3; i++) { |
| 80 setTimeout(translateCommand(original_actions[3 * i + 1], | 80 setTimeout(translateCommand(original_actions[3 * i + 1], |
| 81 original_actions[3 * i + 2]), | 81 original_actions[3 * i + 2]), |
| 82 parseInt(original_actions[3 * i])); | 82 parseInt(original_actions[3 * i])); |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 | |
|
annacc
2011/06/13 18:51:37
extra lines?
imasaki1
2011/06/13 23:43:09
Done.
| |
| 87 | |
| 86 var container = document.getElementById('player_container'); | 88 var container = document.getElementById('player_container'); |
| 87 container.innerHTML = '<' + tag + ' controls id="player"></' + tag + '>'; | 89 container.innerHTML = '<' + tag + ' controls id="player"></' + tag + '>'; |
| 88 player = document.getElementById('player'); | 90 player = document.getElementById('player'); |
| 89 | 91 |
| 90 // Install event handlers. | 92 // Install event handlers. |
| 91 InstallEventHandler('error', | 93 InstallEventHandler('error', |
| 92 'document.title = "ERROR = " + player.error.code'); | 94 'document.title = "ERROR = " + player.error.code'); |
| 93 InstallEventHandler('playing', 'document.title = "PLAYING"'); | 95 InstallEventHandler('playing', 'document.title = "PLAYING"'); |
| 94 InstallEventHandler('ended', 'document.title = "END"'); | 96 InstallEventHandler('ended', 'document.title = "END"'); |
| 95 | 97 |
| 96 player.src = media_url; | 98 player.src = media_url; |
| 99 | |
| 100 if (queryString('track')) { | |
| 101 track_file = queryString('track') | |
|
dennis_jeffrey
2011/06/13 22:51:49
nit: "var track_file". Also put semi-colon at end
imasaki1
2011/06/13 23:43:09
Done.
| |
| 102 var trackElement = document.createElement('track'); | |
| 103 trackElement.setAttribute('id', 'track'); | |
| 104 trackElement.setAttribute('kind', 'captions'); | |
| 105 trackElement.setAttribute('src', track_file); | |
| 106 trackElement.setAttribute('srclang', 'en'); | |
| 107 trackElement.setAttribute('label', 'English'); | |
| 108 trackElement.setAttribute('default', 'true'); | |
| 109 player.appendChild(trackElement); | |
| 110 } | |
| OLD | NEW |