HJÆLP det haster

Tags:    java

Heey.. er ved at redesigne mediaplayer'en da den skal spilles på en hjemmeside....
Har et problem med min kode for den vil ikke finde min lokale video fil?

flg kode ser sådan ud:


<HTML>
<HEAD>
<TITLE>Embedded Player Control Sample</TITLE>
</HEAD>

<BODY onLoad = "Init();">


<OBJECT id=Player classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 height="200" width="200">
<PARAM NAME="autoStart" VALUE="true">
<embed src="Allan.wmv" width="200" height="200" autostart="true"></embed> </OBJECT>

<BR><BR>
<INPUT type=button value="Play Video" name=btnPlayVideo onclick=PlayVideo()>
<INPUT type=button value=" Pause " name=btnPause onclick=PauseMe()>
<INPUT type=button value="Stop" name=btnStop onclick=StopMe()>


<BR><BR>

<SCRIPT language = "JScript">

var g_bPaused = false; // To track pause button state;

// Check for JScript errors.
onerror = ShowError;

// Display JScript errors.
function ShowError (msg,url,linenumber)
{
alert(msg + " at line " + linenumber);
}

// Initialized states.
function Init()
{
Player.uiMode = "none";
btnPause.disabled = true;
btnStop.disabled = true;

// Request Media Libary access rights, if none exists.
if( Player.settings.mediaAccessRights == "none" )
{
// Request access rights.
Player.settings.requestMediaAccessRights( "read" );
}
}


// Play a known video file from Media Library.
function PlayVideo ()
{
var plRet;
plRet = Player.mediaCollection.getByName('Allan');

if( plRet.count > 0 )
{
Player.currentPlaylist = plRet;
}
else
{
alert ("Media not found in Media Library.");
}
}


// Pause the Player.
function PauseMe ()
{
if( g_bPaused == true )
{
Player.controls.play();
g_bPaused = false;
btnPause.value = " Pause ";
}
else
{
Player.controls.pause();
g_bPaused = true;
btnPause.value = "Resume";
}
}

// Stop the Player.
function StopMe ()
{
Player.controls.stop();
}

</SCRIPT>

<SCRIPT LANGUAGE = "JScript" FOR = Player EVENT = PlayStateChange(NewState)>

// Test for the current state.
// If playing, display the name of the current media.

switch (NewState){
case 1:
divState.innerHTML = "Playstate: Stopped";

// Toggle the button states.
btnPause.disabled = true;
btnPause.value = " Pause ";
btnStop.disabled = true;

break;

case 2:
divState.innerHTML = "Playstate: Paused";
break;

case 3:
divState.innerHTML = "Playstate: Playing";
divName.innerHTML = "Media name: " + Player.currentMedia.name;

// Toggle the button states.
btnPause.disabled = false;
btnStop.disabled = false;

break;

case 6:
divState.innerHTML = "Playstate: Buffering";
break;

case 7:
divState.innerHTML = "Playstate: Waiting";
break;

case 8:
divState.innerHTML = "Playstate: Media Ended";
break;

case 9:
divState.innerHTML = "Playstate: Transitioning";
break;

case 10:
divState.innerHTML = "Playstate: Ready";
break;

// Other cases go here.

default:
divState.innerHTML = "Playstate: Other";
}

</SCRIPT>

<SCRIPT LANGUAGE = "JScript" FOR = Player EVENT = StatusChange()>

// Display status. This requires Windows Media Player 9 Series or later.
divStatus.innerHTML = "Status: " + Player.status;

</SCRIPT>

<SCRIPT LANGUAGE = "JScript" FOR = Player EVENT = Error()>

var strError = "";

// Store the number of errors in the queue.
var max = Player.error.errorCount

// Loop through the list of errors.
for (var i = 0; i < max; i++)
{
// Display the error description for each item.
strError += "Error: " + Player.error.item(i).errorDescription + "\\n";
}

alert( strError ); // Display the error warning.

// Clear the error queue to prepare for the next group of errors.
Player.error.clearErrorQueue();

</SCRIPT>

</BODY>
</HTML>




5 svar postet i denne tråd vises herunder
0 indlæg har modtaget i alt 0 karma
Sorter efter stemmer Sorter efter dato
Kunne vi måske se det originale kode uden dine ændringer.. jeg formoder det er lidt copy paste der ikke virker.. endvidere vil jeg gerne have den rigtige fejl meddelelse..

Men et bud ville være at den hopper frem med en Java alert der skriver

alert ("Media not found in Media Library.");

fordi denne ikke kan findes..

Player.mediaCollection.getByName('Allan');


Med venlig hilsen
/Jokke Jensen
www.jj-multimediedesign.dk



[Redigeret d. 28/10-04 17:06:24 af Jokke Jensen]



Kunne vi måske se det originale kode uden dine ændringer.. jeg formoder det er lidt copy paste der ikke virker.. endvidere vil jeg gerne have den rigtige fejl meddelelse..

Men et bud ville være at den hopper frem med en Java alert der skriver

alert ("Media not found in Media Library.");

fordi denne ikke kan findes..

Player.mediaCollection.getByName('Allan');


Med venlig hilsen
/Jokke Jensen
www.jj-multimediedesign.dk


Jeg har løst ptoblemet.. kan i evt hjælpe med at lave sådan at jeg kan tænde og slukke for lyden der er i min video?




[Redigeret d. 28/10-04 17:06:24 af Jokke Jensen]

Flash fremtidens nye udvikling til web :)



Min kode se sådan ud nu :)




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<OBJECT ID="WinMedia" width=160 height=120
classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
codebase="http://activex.microsoft.com/activex/controls/
mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby=
"Loading Microsoft® Windows® Media Player components..."
type="application/x-oleobject">
<PARAM NAME="FileName" VALUE="allan.wmv">
<PARAM NAME="AutoStart" Value="True">
<PARAM NAME="ShowControls" VALUE="False">
<PARAM NAME="ShowStatusBar" VALUE="True">
<PARAM NAME="AudioStream" VALUE="-1">
<PARAM NAME="Volume" VALUE="-400">


<span id="volumeSpacer">

function makeVolumeButtons() {
var str = "";
str += "<FONT SIZE=2 COLOR='#ffffff'>Volume</FONT><BR>";
if (NSsound) {

str += "<A HREF='javascript:void(0)' " +
"onClick='if (!document.layers) changeVolume(1)' " +
"onMouseDown='return startSlide(1)' onMouseUp='stopSlide()' " +
"onMouseOver='return display(\\"Increase volume\\")' " +
"onMouseOut='return display(\\"\\")'><IMG " +
"SRC='loud_speaker.gif' WIDTH='9' HEIGHT='10' HSPACE='2' " +
"VSPACE='3' BORDER='0'></A>";

str += "<A HREF='javascript:void(0)' " +

"onClick='if (!document.layers) changeVolume(-1)' " +
"onMouseDown='return startSlide(-1)' onMouseUp='stopSlide()' " +
"onMouseOver='return display(\\"Decrease volume\\")' " +
"onMouseOut='return display(\\"\\")'><IMG " +
"SRC='silent_speaker.gif' WIDTH='9' HEIGHT='10' HSPACE='2' " +
"VSPACE='3' BORDER='0'></A>";

} else {

str += "<IMG SRC='loud_speaker.gif' WIDTH='9' HEIGHT='10' " +
"HSPACE='2' VSPACE='3' " +
"onMouseOver='return display(\\"Increase volume\\")' " +
"onMouseOut='return display(\\"\\")' " +
"onMouseDown='return startSlide(1)' onMouseUp='stopSlide()'>";

str += "<IMG SRC='silent_speaker' WIDTH='9' HEIGHT='10' " +
"HSPACE='2' VSPACE='3' " +
"onMouseOver='return display(\\"Decrease volume\\")' " +
"onMouseOut='return display(\\"\\")' " +
"onMouseDown='return startSlide(-1)' onMouseUp='stopSlide()'>";
}
return str;
}



<EMBED type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/Windows/
MediaPlayer/" SRC="../Video%20INTERFACE!!/allan.wmv" name="WinMedia"
autostart=1 width=160 height=120 ShowStatusBar=true
ShowControls=false>
</EMBED>
</OBJECT>

<FORM NAME="PlayerButtons">
<INPUT NAME="Playbtn" TYPE="Button" VALUE="Play"
onclick="document.WinMedia.Play();">
<INPUT NAME="Pausebtn" TYPE="Button" VALUE="Pause"
onclick="document.WinMedia.Pause();">
<INPUT NAME="Stopbtn" TYPE="Button" VALUE="Stop"
onclick="document.WinMedia.Stop();">
<INPUT type=image src="silent_speaker.gif" name="Voldown"VALUE="changeVolume(-1)"
onclick="changevolume(-1)"

<INPUT type=image src="loud_speaker.gif" name="Voldown"VALUE="changeVolume(-1)"
onclick="changevolume(-1)"






</FORM>

</body>
</html>





"HJÆLP det haster" og alligevel er du så dum at poste i et forkert forum.

I tilfælde af folk ikke har forstået det endnu:

JAVA ER IKKE JAVACRIPT !!!


og hvis du stadig ikke har forstået det, så har du postedet noget javscript ikke java.

http://java.sun.com <- JAVA !



t