FutureQuest, Inc. FutureQuest, Inc. FutureQuest, Inc.

FutureQuest, Inc.
Go Back   FutureQuest Community > General Site Owner Support (All may read/respond) > General Coding/Development
User Name
Password  Lost PW

Reply
 
Thread Tools Search this Thread Display Modes
Old 02-06-2003, 01:09 PM   Postid: 81746
andyjr
Visitor

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Feb 2003
Location: UK
Posts: 5
Windows Media Player Plug In and Javascript

I have written a javascript file for a html page that when clicked parameters are passed that create a new window and load the Windows media player 6.4 plug in to play the MP3 file I have passed it. However using IE 5.5 the file is unloaded and the plug in greyed out with an error message saying Syntax error. Using Netscape seven the plug in works and the MP3 is played. However if I view the source under IE of the created window and save it as a new html file and load it seperately it works perfectly. Is this a bug possibly with Windows Media player or IE.
andyjr is offline   Reply With Quote
Old 02-06-2003, 06:31 PM   Postid: 81767
Randall
Fuzzier than thou
 
Randall's Avatar

Forum Notability:
1187 pts: A True Crowd-pleaser!
[Post Feedback]
 
Join Date: Nov 2002
Posts: 9,640
Without knowing what code you're using in your script, it's gonna be hard for anyone to give you useful advice. "Syntax error" could mean a lot of things.

Randall
Randall is offline   Reply With Quote
Old 02-06-2003, 06:46 PM   Postid: 81769
andyjr
Visitor

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Feb 2003
Location: UK
Posts: 5
code

Here is the javascript code

var ggWinSound;
var fontface = "Tahoma";
var fontsize = 2;

soundbit.general = ["Cavatina", "Meditation", "1st Arabesque", "I Dreamed a Dream"];

soundbit.wedding = ["Trumpet Voluntary", "Arrival of the Queen of Sheba", "Flower Duet", "Spring", "Canon", "Someone To Watch Over Me"];

soundbit.type = ["General Repertoire", "Music for Weddings"];

function soundbit(song, p_WinSound, song_type, song_file) {

this.songfile = song_file;
this.gWinSound = ggWinSound;
if (p_WinSound == null)
this.gWinSound = ggWinSound;
else
this.gWinSound = p_WinSound;
if (song_type == 0) {
this.soundbname = soundbit.get_general(song);
} else {
this.soundbname = soundbit.get_wedding(song);
}
this.songtype = soundbit.get_type(song_type);
this.gBGColor = "white";
this.gFGColor = "black";
this.gTextColor = "black";
this.gHeaderColor = "black";
}

soundbit.get_type = soundb_get_type;
soundbit.get_general = soundb_get_general;
soundbit.get_wedding = soundb_get_wedding;
new soundbit();


function soundb_get_type(monthNo) {
return soundbit.type[monthNo];
}

function soundb_get_general(monthNo) {
return soundbit.general[monthNo];
}

function soundb_get_wedding(monthNo) {
return soundbit.wedding[monthNo];
}

soundbit.prototype.show = function() {

var vCode = "";

this.gWinSound.document.open();

// Setup the page...
this.wwrite("<html>");
this.wwrite("<head><title>Sound Bites</title>");
this.wwrite("</head>");

this.wwrite("<body bgcolor=\"#FFFFFF\" " +
"link=\"" + this.gLinkColor + "\" " +
"vlink=\"" + this.gLinkColor + "\" " +
"alink=\"" + this.gLinkColor + "\" " +
"text=\"" + this.gTextColor + "\">");
this.wwrite("<P align=\"center\"> ");
this.wwrite("<OBJECT ID=\"MediaPlayer\" WIDTH=200 HEIGHT=42 ");
this.wwrite("CLASSID=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" ");
this.wwrite("STANDBY=\"Loading Windows Media Player components...\" ");
this.wwrite(" TYPE=\"application/x-oleobject\">");
this.wwrite("<PARAM NAME=\"Autostart\" VALUE=\"False\" >");
this.wwrite("<PARAM NAME=\"Filename\" VALUE=\"sounds/" + this.songfile + "\">");
this.wwrite("<EMBED TYPE=\"application/x-mplayer2\" src=\"sounds/" + this.songfile + "\" NAME=\"MediaPlayer\" autostart=0 WIDTH=200 HEIGHT=42></EMBED>");
this.wwrite("</OBJECT>");
this.wwrite("</p>");




this.wwrite("<p align=\"center\"><font face=\"Tahoma\" size=\"4\">" + this.songtype + " </font>");
this.wwrite("<p align=\"center\"><font face=\"Tahoma\" size=\"3\">" + this.soundbname + "</font></p>");

this.wwrite("</body></html>");
this.gWinSound.document.close();

}

soundbit.prototype.wwrite = function(wtext) {
this.gWinSound.document.writeln(wtext);
}

soundbit.prototype.wwriteA = function(wtext) {
this.gWinSound.document.write(wtext);
}


function Build(song, song_type, song_file) {
var p_WinSound = ggWinSound;
gSound = new soundbit(song, p_WinSound, song_type, song_file);

// Customize Window here.
gSound.gBGColor="white";
gSound.gLinkColor="black";
gSound.gTextColor="black";
gSound.gHeaderColor="darkgreen";
gSound.show();

}


function show_song() {
/*
Song
*/
song = arguments[0];
song_type = arguments[1];
song_file = arguments[2];

vWinSound = window.open("", "Soundbites",
"width=250,height=250,status=no,resizable=no,top=200,left=200 ");
vWinSound.opener = self;
ggWinSound = vWinSound;
if (!vWinSound.opener) vWinSound.opener = self;
Build(song, song_type, song_file);
if (!vWinSound.opener) vWinSound.opener = self;

}
andyjr is offline   Reply With Quote
Old 02-06-2003, 08:47 PM   Postid: 81782
Randall
Fuzzier than thou
 
Randall's Avatar

Forum Notability:
1187 pts: A True Crowd-pleaser!
[Post Feedback]
 
Join Date: Nov 2002
Posts: 9,640
I was hoping I could test your code here, but I'm probably doing something wrong.

Do you get a little "!" icon in the bottom left corner of the IE window when you run it? Clicking on that would bring up an error dialog, and when you click on Details (?) it should give you a line number where the error occured. That would help narrow it down.

Unless someone else can see the problem in the code?

Randall

Lot of unanswered questions here today. Where have all our experts gone?
Randall is offline   Reply With Quote
Old 02-06-2003, 10:50 PM   Postid: 81791
andyjr
Visitor

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Feb 2003
Location: UK
Posts: 5
No icon

No I get no icon. The window appears as it should but windows Media player does not load the file. f I right click on the WIndows media player plugin and goto error details it says syntax error but won't give any other details. However if I copy the generated HTML into another file and load it it works fine. I am wondering if it is a bug with Windows Media Player but haven't seen anything on the Microsoft web site
andyjr is offline   Reply With Quote
Old 02-07-2003, 12:32 AM   Postid: 81798
Randall
Fuzzier than thou
 
Randall's Avatar

Forum Notability:
1187 pts: A True Crowd-pleaser!
[Post Feedback]
 
Join Date: Nov 2002
Posts: 9,640
OK. Having concluded that the filename manipulation functions were distracting me from the meat of the script, I've stripped it down slightly.

The following code works for me using IE 6.0 and Windows Media Player 6.4.09.1124. Make sure it works on your system, and then we can work backwards from there.
Code:
<html><body>

<script language="JavaScript1.2">

this.songfile = "insert.name.of.song.file";

document.write("<body bgcolor=\"#FFFFFF\" >");
document.write("<P align=\"center\"> ");
document.write("<OBJECT ID=\"MediaPlayer\" WIDTH=200 HEIGHT=42 ");
document.write("CLASSID=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" ");
document.write("STANDBY=\"Loading Windows Media Player components...\" ");
document.write("TYPE=\"application/x-oleobject\">");
document.write("<PARAM NAME=\"Autostart\" VALUE=\"False\" >");
document.write("<PARAM NAME=\"Filename\" VALUE=\"sounds/" + this.songfile + "\">");
document.write("<EMBED TYPE=\"application/x-mplayer2\" src=\"sounds/" + 
this.songfile + "\" NAME=\"MediaPlayer\" autostart=0 WIDTH=200 HEIGHT=42></EMBED>");
document.write("</OBJECT>");
document.write("</p>");

</script>

</body></html>
Randall
Randall is offline   Reply With Quote
Old 02-07-2003, 11:09 AM   Postid: 81843
andyjr
Visitor

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Feb 2003
Location: UK
Posts: 5
Changed this.songfile

I did as you suggested but it hasn't made any difference. I am wondering whether when creating an HTML page from within another as we are doing here and incorporating the WIndows Media player plug in that this does not work properly when you try to load in a file. I have tried it on a computer with Windows Media Player 9 and it works fine.
andyjr is offline   Reply With Quote
Old 02-07-2003, 04:22 PM   Postid: 81856
Randall
Fuzzier than thou
 
Randall's Avatar

Forum Notability:
1187 pts: A True Crowd-pleaser!
[Post Feedback]
 
Join Date: Nov 2002
Posts: 9,640
My stripped-down version didn't work either? It's not creating a second HTML file in this case -- just inserting code into an existing one. I kept it as simple as possible, hoping that would give you a working example to start from.

Before you give up, try this. It's the same HTML, but all of the Javascript code has been removed.
Code:
<html><body>

<P align="center">
<OBJECT ID="MediaPlayer" WIDTH=200 HEIGHT=42 
 CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" 
 STANDBY="Loading Windows Media Player components..." 
 TYPE="application/x-oleobject">
<PARAM NAME="Autostart" VALUE="False">
<PARAM NAME="Filename" VALUE="sounds/insert.filename.here">
<EMBED TYPE="application/x-mplayer2" src="insert.filename.here" 
 NAME="MediaPlayer" autostart=0 WIDTH=200 HEIGHT=42>
</EMBED>
</OBJECT>
</p>

</body></html>
Randall
Randall is offline   Reply With Quote
Old 02-07-2003, 06:58 PM   Postid: 81874
andyjr
Visitor

Forum Notability:
0 pts:
[Post Feedback]
 
Join Date: Feb 2003
Location: UK
Posts: 5
Works

To do this I need to save a separate Html file and yes in doing so this works fine. It is only a problem when I use javascript create a window with the media server plugin (V6.4) in it which is why I am coming to the opinion there is a bug somewhere as is works with wmp v9 (unfortunately not everyone has v9). I am now contemplating creating and saving a file with the above in and jsuing javascript to pass it parameters rather than creating the file from scratch at run time.
andyjr is offline   Reply With Quote
Old 02-07-2003, 09:13 PM   Postid: 81889
Randall
Fuzzier than thou
 
Randall's Avatar

Forum Notability:
1187 pts: A True Crowd-pleaser!
[Post Feedback]
 
Join Date: Nov 2002
Posts: 9,640
That's exactly what I was going to suggest. It's hard to know if this is a problem with certain versions of Media Player, or a an IE/Javascript bug. Better to keep it as simple as possible.

Randall
Randall is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 visitors)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 05:29 PM.


Running on vBulletin®
Copyright © 2000 - 2013, Jelsoft Enterprises Ltd.
Hosted & Administrated by FutureQuest, Inc.
Images & content copyright © 1998-2013 FutureQuest, Inc.
FutureQuest, Inc.