{"id":32,"date":"2008-12-08T22:18:00","date_gmt":"2008-12-09T03:18:00","guid":{"rendered":"http:\/\/lukerymarz.com\/alearningexperience\/2008\/12\/quicktime-player-in-internet-explorer.html"},"modified":"2008-12-08T22:18:00","modified_gmt":"2008-12-09T03:18:00","slug":"quicktime-player-in-internet-explorer","status":"publish","type":"post","link":"http:\/\/lukerymarz.com\/alearningexperience\/2008\/12\/quicktime-player-in-internet-explorer.html","title":{"rendered":"QuickTime Player in Internet Explorer"},"content":{"rendered":"<p>I&#8217;ve recently been working on getting QuickTime player to work in Internet Explorer (and Firefox and Safari), and as you might expect there are some catches to getting a rich QuickTime UI to work with IE.  By rich QuickTime UI, I mean a UI you&#8217;ve built yourself that embeds a QuickTime window.  Furthermore, to keep your UI updated to the state of the player, you&#8217;re using DOM events.  I thought I&#8217;d do a brain dump to refresh my own memory and potentially help some others.  So here we go:<\/p>\n<p><span style=\"font-weight: bold;\">Question 1<\/span>: Why don&#8217;t my DOM events work in Internet Explorer?<\/p>\n<p><span style=\"font-weight: bold; font-style: italic;\">Answer<\/span>:  They work, but they don&#8217;t work properly, that&#8217;s for sure.  The Apple documentation provides an example the just doesn&#8217;t work.  QuickTime DOM events won&#8217;t get sent unless you add a [relatively simple] hack, the essence of which requires you to reload the clip you&#8217;re playing.  Pseudocode looks like this (in javascript):<\/p>\n<p>load clip in QuickTime<br \/>wait until plugin status is loaded (or complete )<\/p>\n<p>\/\/ begin hack<br \/>quicktimeMovie.SetResetPropertiesOnReload(false);<br \/>quicktimeMovie.setURL(movieURL);<br \/>registerDOMEvents(quicktimeMovie);<br \/>\/\/ end hack<\/p>\n<p>So essentially, you have to generate your object\/embed code, load the quicktime player once (by setting innerHTML somewhere), and then do a setURL with the same clip before registering for DOM Events.  If you don&#8217;t do the setURL, you won&#8217;t get DOM events.<\/p>\n<p>Note that for other browsers you don&#8217;t have to do this.  So I suggest you wrap this code up in an if(IE) block.<\/p>\n<p><span style=\"font-weight: bold;\">Question 2<\/span>:  With the hack above (in IE), why does my app hang when loading long (15 minutes plus) clips?<\/p>\n<p><span style=\"font-weight: bold; font-style: italic;\">Answer<\/span>:  Your app is hanging because the QuickTime plugin didn&#8217;t get time to stabilize before you called setURL.  I didn&#8217;t find a way around this, but a solid solution is to use a dummy clip (1 or 2 seconds of black) that you load up <span style=\"font-style: italic;\">before<\/span> loading your real clip.  Once you&#8217;ve got DOM events registered, you can use setURL to switch to other clips.  Pseudocode looks something like this:<\/p>\n<p>function initQuickTime()<br \/>{<br \/>    [code from answer 1 loading a dummy clip]<br \/>}<\/p>\n<p>function loadClip(clip)<br \/>{<br \/>    if(firstLoad)<br \/>    {<br \/>        initQuickTime();<br \/>    }<br \/>    quicktimeMovie.setURL(clip);<br \/>}<\/p>\n<p>And you&#8217;re good to go.  setURL can be used from here on in if you need to switch clips.<\/p>\n<p><span style=\"font-weight: bold;\">Other Notes:<\/span><\/p>\n<p>1.  <span style=\"font-style: italic;\">You can&#8217;t resize the QuickTime window without reloading the clip.<\/span>  I really want to be wrong about this, but if you need to change the size of the video window, you have to redo your object\/embed code.  Kind of a pain, but resizing has to be done almost never, so it&#8217;s workable.<\/p>\n<p>2.  <span style=\"font-style: italic;\">If you&#8217;re writing debug code, make sure all your test clips are on your http server.  <\/span>I made this mistake and wasted a couple hours.  If, for example, you&#8217;re working my pseudocode in question 2 and your dummy clip is on your PC, but your app accesses clips on an http server somewhere, <span style=\"font-weight: bold;\">it just won&#8217;t work<\/span>.  QuickTime player has some initialization in it that defaults to either local files or http files (I don&#8217;t really know the details).<\/p>\n<p>That&#8217;s about it.  Overall I really like QuickTime player.  Compared to the directshow work I&#8217;ve done, it&#8217;s a lot easier to use.  There are a lot less corner cases you have to deal with (if you&#8217;re trying to get frame accuracy, for example).  The compatibility issues in diffferent browsers come with the turf, and they&#8217;re realtively easy to deal with elegantly if you know what you&#8217;re up against.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve recently been working on getting QuickTime player to work in Internet Explorer (and Firefox and Safari), and as you might expect there are some catches to getting a rich QuickTime UI to work with IE. By rich QuickTime UI, I mean a UI you&#8217;ve built yourself that embeds a QuickTime window. Furthermore, to keep [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[13,14,4,12,15],"tags":[],"class_list":["post-32","post","type-post","status-publish","format-standard","hentry","category-dom-events","category-hacks","category-html","category-internet-explorer","category-quicktime"],"_links":{"self":[{"href":"http:\/\/lukerymarz.com\/alearningexperience\/wp-json\/wp\/v2\/posts\/32","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/lukerymarz.com\/alearningexperience\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/lukerymarz.com\/alearningexperience\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/lukerymarz.com\/alearningexperience\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/lukerymarz.com\/alearningexperience\/wp-json\/wp\/v2\/comments?post=32"}],"version-history":[{"count":0,"href":"http:\/\/lukerymarz.com\/alearningexperience\/wp-json\/wp\/v2\/posts\/32\/revisions"}],"wp:attachment":[{"href":"http:\/\/lukerymarz.com\/alearningexperience\/wp-json\/wp\/v2\/media?parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/lukerymarz.com\/alearningexperience\/wp-json\/wp\/v2\/categories?post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/lukerymarz.com\/alearningexperience\/wp-json\/wp\/v2\/tags?post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}