473,396 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

controlling mediaplayer source through javascript in Firefox

42
ok here is my problem,

I am trying to change the source file of the mediplayer using javascript, my script works perfectly in "Internet Explorer", but no matter what I do, it doesn't work in Firefox

here is my player :
[HTML]
<OBJECT classid=CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95
height=276 id=mediaPlayer type=application/x-oleobject width=320
standby="Loading Video...">
<embed
id="mediaPlayer"
type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/windows/windowsmedia/download/"
src="dummy.asx"
name="mediaPlayer"
width="320"
height="276"
autostart="0"
showcontrols="0" >
</embed>
</OBJECT>
[/HTML]

and here is the javascript function called to change the source:


Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">  
  2. filename = 'somename.wmv';
  3. movieName = 'mediaPlayer';
  4. if (window.document[movieName]) {window.document[movieName].fileName = filename;}
  5. if (navigator.appName.indexOf("Microsoft Internet")==-1){if (document.embeds && document.embeds[movieName]) document.embeds[movieName].fileName = filename; }
  6. else {document.getElementById(movieName).fileName = filename;}
  7. </script>
  8.  
any help is really appreciated.
Dec 17 '07 #1
7 3367
acoder
16,027 Expert Mod 8TB
Firstly, you can't have two elements with the same ID.

Secondly, FileName should be a param object within the object tags.
Dec 18 '07 #2
xhunter
42
Firstly, you can't have two elements with the same ID.

Secondly, FileName should be a param object within the object tags.
thanx.

as I mentioned, it works perfectly in IE and so param FileName is not really needed.

I tried giving a different name for object and embed, but didn't work again.

it just doesn't work, without returning any errors (firebug).
Dec 18 '07 #3
acoder
16,027 Expert Mod 8TB
as I mentioned, it works perfectly in IE and so param FileName is not really needed.
Just because it works in IE doesn't necessarily mean it's correct.
I tried giving a different name for object and embed, but didn't work again.
The ID needs to be different. You can have two objects with the same name (if need be).

Does this work without using JavaScript, i.e. can you get this to work with HTML only? If not, check that you have the correct plugins.
Dec 18 '07 #4
xhunter
42
it works perfectly in IE with or without javascript (with a source in param),

it works in FF when a real src has been specified,

the javascript is supposed to change that source (with no source specified at first),

the reason that I said that param is not needed is as i think that part of embedding is for IE and in my case that I am not putting any src for initial load and load movies through js it works fine without it, and FF part is inside <embed> which has a src with a dummy source,

The Player works fine,
the only problem is javascript can't change the source in FF,

if the JS script is wrong, I am expecting some errors in FF (firebug), but no errors are returned, meaning the execution was a accepted but I can't get any effect.
Dec 18 '07 #5
xhunter
42
There is another strange thing,

it doesn't really matter to me, but I thought maybe that is sort of related.

This script of mine, in IE , only works with this classid :
"22D6F312-B0F6-11D0-94AB-0080C74C7E95"
which is for WMP6.4

if set to any other calssids:
WMP7-9-10:6BF52A52-394A-11D3-B153-00C04F79FAA6


it doesn't work, not even in IE (no errors),

I don't know why???

Maybe FF plugin is loading WMP in >7 comptaible mode which causes this problem ???

Then the problem is how to change the source if classid is for WMP > 7.
Dec 19 '07 #6
xhunter
42
Ok,
I managed to fix the classid problem by using "url" instead of "filename" that is

document.mediaPlayer.url = address;


but yet it is not working in FF,

I searched on internet and some suggested to use "src" as embed uses this param name, but no success with that either.

I didn't find any working javascript manipulation of WMP for FireFox.

if anybody knows how to do it, it is really appreciated,
I am starting to bang my head to the wall and thinking maybe you cant use JS with WMP in FF.
Dec 19 '07 #7
acoder
16,027 Expert Mod 8TB
Here's a reference for Windows Media Player. Hope it helps.
Dec 20 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Richard Loupatty | last post by:
Does anyone know how to control windows mediaplayer? I would like to give the user the possibility to skip in the player by setting a new startposition. tia Richard
0
by: Rob Vermeulen | last post by:
Hi folks, Please forgive my ignorance but I need to know if it is possible to control ActiveX components on my website from within my serverside C# code. I'm quite an experienced s/w developer...
7
by: unacoder | last post by:
Is it possible to request the user's permission to be able to control IE or FireFox windows that are pointed to domains other than the base domain the script is running from? For example, if my...
12
by: PMA | last post by:
Hi all, I am porting a web application from IE 6.0 to FireFox 1.5. I have solved almost all compatibility issues (quite a lot but not too bad) except two of them : 1) Clipboard access thru'...
2
by: Hymer | last post by:
Hello, I have a footer at the end of each article in my blog at http://www.usernomics.com/news/user-interface-design-news.html . The footer looks perfect in IE but has smaller text in Firefox...
12
by: mistral | last post by:
Can anybody tell me how to get source code of page in iframe? (popup window is clickable image). When I right click on this popup border to view source, i see just as follows <html> <head>...
3
by: Herb | last post by:
I've found how to use javascript to embed a Windows Media Player in a web page. How do I go about controlling the player in response to user input? There should be calls to start, stop and also...
1
by: William Johnston | last post by:
Hi, I modified a thumbnail creation app and get black images since the first second is black as well. My questions are: 1. How do I set the MediaPlayer.Clock property to start screen capture...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.