1<!-- 2 3In order to run this example, put MediaInfo.dll and MediaInfoActiveX.dll 4into your system directory and Example.ogg into the root directory of drive 5C: (i.e. C:\). Use regsvr32.exe which is provided with Windows to register 6MediaInfoActiveX.dll. 7 8Use at own risk, under the same license as MediaInfo itself. 9 10Ingo Br�ckl, May 2006 11 12--> 13 14<html> 15 16 <title>MediaInfo ActiveX Example</title> 17 18 <body> 19 20 <script language="JScript"> 21 document.write("<pre>"); 22 23 var MediaInfo_Stream_General = 0; 24 var MediaInfo_Stream_Audio = 2; 25 var MediaInfo_Info_Name = 0; 26 var MediaInfo_Info_Text = 1; 27 28 var obj = new ActiveXObject("MediaInfo.ActiveX"); 29 30 // information about MediaInfo 31 32 document.write(obj.MediaInfo_Option(0, "Info_Version", "")); 33 34 document.write("\n\nInfo_Parameters\n"); 35 document.write(obj.MediaInfo_Option(0, "Info_Parameters", "")); 36 37 document.write("\n\nInfo_Capacities\n"); 38 // we have to check for IE version, due to stack error with versions < 6 39 var ua = window.navigator.userAgent; 40 var msie = ua.indexOf("MSIE "); 41 if (msie > 0 && parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))) < 6) 42 document.write("(skipped, at least IE 6 required)"); 43 else 44 document.write(obj.MediaInfo_Option(0, "Info_Capacities", "")); 45 46 document.write("\n\nInfo_Codecs (limited to 32500 bytes of data)\n"); 47 document.write(obj.MediaInfo_Option(0, "Info_Codecs", "").substr(0, 32500)); 48 document.write("..."); 49 50 // an example of how to use the library 51 52 document.write("\n\nOpen\n"); 53 var handle = obj.MediaInfo_New(); 54 obj.MediaInfo_Open(handle, "C:\\Example.ogg"); 55 56 document.write("\n\nInform with Complete=false\n"); 57 obj.MediaInfo_Option(handle, "Complete", ""); 58 document.write(obj.MediaInfo_Inform(handle, 0)); 59 60 document.write("\n\nInform with Complete=true\n"); 61 obj.MediaInfo_Option(handle, "Complete", "1"); 62 document.write(obj.MediaInfo_Inform(handle, 0)); 63 64 document.write("\n\nCustom Inform\n"); 65 obj.MediaInfo_Option(handle, "Inform", "General;File size is %FileSize% bytes"); 66 document.write(obj.MediaInfo_Inform(handle, 0)); 67 68 document.write("\n\nGet with StreamKind=General and Parameter=\"FileSize\"\n"); 69 document.write(obj.MediaInfo_Get(handle, MediaInfo_Stream_General, 0, "FileSize", MediaInfo_Info_Text, MediaInfo_Info_Name)); 70 71 document.write("\n\nGetI with StreamKind=General and Parameter=13\n"); 72 document.write(obj.MediaInfo_GetI(handle, MediaInfo_Stream_General, 0, 13, MediaInfo_Info_Text)); 73 74 document.write("\n\nCount_Get with StreamKind=Audio\n"); 75 document.write(obj.MediaInfo_Count_Get(handle, MediaInfo_Stream_Audio, -1)); 76 77 document.write("\n\nGet with StreamKind=General and Parameter=\"AudioCount\"\n"); 78 document.write(obj.MediaInfo_Get(handle, MediaInfo_Stream_General, 0, "AudioCount", MediaInfo_Info_Text, MediaInfo_Info_Name)); 79 80 document.write("\n\nGet with StreamKind=Audio and Parameter=\"StreamCount\"\n"); 81 document.write(obj.MediaInfo_Get(handle, MediaInfo_Stream_Audio, 0, "StreamCount", MediaInfo_Info_Text, MediaInfo_Info_Name)); 82 83 document.write("\n\nClose\n"); 84 obj.MediaInfo_Close(handle) 85 obj.MediaInfo_Delete(handle) 86 87 document.write("</pre>"); 88 </script> 89 90 </body> 91 92</html> 93