File: indexw.html

Recommend this page to a friend!
  Classes of Dantigny francois   Javascript MPEG Parser   indexw.html   Download  
File: indexw.html
Role: Example script
Content type: text/plain
Description: Example
Class: Javascript MPEG Parser
Parse and extract details from MPEG video files
Author: By
Last change: Added files via upload
Date: 3 years ago
Size: 3,202 bytes
 

Contents

Class file image Download
<!DOCTYPE html> <html> <head> <title>Test</title> <style type="text/css"> #inp{ display : inline; } #opt{ display : none; } </style> <script type="text/javascript"> var ind=0; var res=[]; var fileinput=[]; function change_ind(t) { document.querySelector('#out').innerHTML = ""; document.querySelector('#out').innerHTML = res[t].data; } function init(){ document.querySelector('#inp').onchange = function(e) { var MPGworker = new Worker('workerMPG.js'); MPGworker.addEventListener('message', function(e) { if (e.data.data != 'nop'){ res.push(e.data); } else { var tmp={}; tmp.data=fileinput[res.length].name+" isn't a MPG file !"; res.push(tmp); } if (res.length < fileinput.length){ ind++; MPGworker.postMessage({MPGfile : fileinput[ind], speedy : speedy}); } else { document.getElementById("inp").style.display="none"; for (var k=0; k<res.length; k++){ new_element = new Option(fileinput[k].name, k, false, true); document.getElementById("opt").options[document.getElementById("opt").options.length] = new_element; } document.querySelector("#opt").selectedIndex=0; document.querySelector("#opt").style.display="block"; document.querySelector('#out').innerHTML = ""; document.querySelector('#out').innerHTML = res[0].data; } }, false); fileinput=e.target.files; MPGworker.postMessage({MPGfile : fileinput[ind], speedy : speedy}); } } </script> </head> <body onload="init()"> <center> <input id="inp" type="file" multiple> <br> Mode : <input id="toggle" type="button" value="Complete"> <br> <select size="1" id="opt" onchange="change_ind(document.getElementById('opt').options.selectedIndex)"></select> <br> <textarea id="out" rows="40" cols="120">And then ? Choose some MPEG Files ... </textarea> </center> <script type="text/javascript"> var speedy = false; document.querySelector('#toggle').onclick = function(e) { if (document.querySelector('#toggle').value == "Complete"){ speedy = true; document.querySelector('#toggle').value = "Speedy"; } else { speedy = false; document.querySelector('#toggle').value = "Complete"; } } document.querySelector('#inp').onchange = function(e) { var ind=0; var res=[]; var fileinput=[]; } </script> </body> </html>