LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-02-2008, 09:48 PM   #1
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
javascript > embeded objects > onMediaComplete() not working on OSX


I've made a little video player that does some javascript when a video finishes playing (it's a kind of playlist alternative, among other things).

In any event, on Linux, it works fine.. the video plays, it stops (because it's over), then the javascript function that gets called by OnMediaComplete runs & the interface changes. On Firefox 2.0 running on OSX, however, the OnMediaComplete function isn't running. Nothing happens - the function doesn't even get called (verified by outputting some javascript debug messages).

My embed (html) looks like:
Code:
      embed
       id='thevideo'
       name='thevideo' 
       nocache=0 
       autostart=1 
       src='<%= embed_link %>' 
       loop='false' 
       width='<%= xres %>' 
       height='<%= yres %>'
       onMediaComplete='javascript:changer();'
and my changer function looks like:
Code:
function changer(inc) {
    document.getElementById("debug").innerHTML = "changer:";
    if (inc != null)
	counter = inc;
    else
	counter = (counter >= vidcount) ? 0 : counter;
    var prev = (counter == 0) ? (vidcount-1) : (counter-1);
    document.embeds['thevideo'].filename=vids[counter];
    
    var tds = document.getElementsByTagName("td");
    for(var i = 0; i < tds.length; i++){
	tds[i].className = (tds[i].className == "highlight") ? "thumb" : tds[i].className;
    }
    document.getElementById(counter).className="highlight";
    document.thevideo.Play();
    el = document.getElementById("external");
    el.setAttribute("href","./templates/force_download.php?file="+file[counter]);
    document.getElementById("debug").innerHTML += vids[counter];
    if (!looping)
	counter++;
    player();
}
Note that not even the first line of changer runs. Even if I only put that one innerHTML call in there - no go. I have verified that innerHTML does, in fact, work on this machine, so it's not that javascript is disabled or anything.

Any ideas on why this works under Linux but not under OSX? Maybe it's something in the embed - maybe I'm not calling the function properly?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript from AdSense not working properly linux-rulz General 2 03-29-2005 11:25 PM
dynamically add objects in JavaScript djgerbavore Programming 1 03-11-2005 09:41 PM
powerbook ALSA stops working after reinstalling OSX? fibbi Linux - Laptop and Netbook 2 12-26-2004 08:38 PM
3com NIC embeded on an ASUS P4P800 not working on kernel 2.6.0 XStorm Linux - Hardware 1 10-04-2004 07:58 AM
Javascript not working in mozilla 1.6 ..Plz Help Me its_m3 Linux - Software 0 07-29-2004 04:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:59 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration