Verbium
Verbium

Reputation: 57

HTML5/Javascript not executing in firefox - XML reading

I'm trying to get some code working that reads information in from an xml file. This works fine in google chrome but when I try to get it to work with firefox it refuses to load the html5 video I have linked. I've read in places that firefox has a different way of bringing in xml as it treats local content as insecure. Is this correct?

A working example can be found at www.oupnmv.com/dev/

My code:

            <!DOCTYPE HTML>
            <html>
            <head>
            <meta charset="UTF-8">
            <title>Testing HTML5 pausing</title>

            </head>

            <body>
            <video id="myvid" width="320" height="240" controls>
              <source src="video.m4v" type="video/mp4" />
              Your browser does not support the video tag.
            </video>
            <div id="time"></div>
            <script type="text/javascript">
            (function(){
                    var v = document.getElementsByTagName('video')[0]
                    var t = document.getElementById('time');
                var i = new Array("5", "10", "15", "25");
                var toggle = 0;
                var time;
                var c = 0;
                var cue = new Array();


                function callXML(cue){
                var b = 0;
                xmlhttp=new XMLHttpRequest();
                xmlhttp.open("GET", "cue_word.xml", false);
                xmlhttp.send();
                xmlDoc=xmlhttp.responseXML;
                x = xmlDoc.getElementsByTagName("Cue");
                for (b=0;b<x.length;b++){

                cue[b] = xmlDoc.getElementsByTagName("Cue")[b].getAttribute("value");
                }
                }

                callXML(cue);
                v.addEventListener('timeupdate',function(event){
                 //t.innerHTML = v.currentTime;
                  time = parseInt(v.currentTime);
                      if (time == i[c] && toggle == 0){
                    v.pause();
                    t.innerHTML = "Enter some test questions here ";
                    t.innerHTML += cue[c];
                    //toggle = 1;
                    c++;
                    }
              },false);
             })();

            </script>
            </body>
            </html>

Upvotes: 0

Views: 434

Answers (2)

Boris Zbarsky
Boris Zbarsky

Reputation: 35064

You're using an H.264 video. Firefox does not support those, and Chrome is planning to remove support for them as well. Opera doesn't support them either.

Upvotes: 1

Shane
Shane

Reputation: 2047

Have you checked Firefox's error console to see if anything is not how it should be?

Upvotes: 0

Related Questions