Hello all, i need a movie/mediaplayer and i could imagine that it would be in javascript.
all it should be able to do is to play mp3(music) and wmv(movie) files.
it need a start,stop,pause and fullscreen button.
anyone can give me a code just to place in my page?
thnx to everyone where want to help.

Recommended Answers

All 8 Replies

<OBJECT id="VIDEO" width="320" height="240" 
	style="position:absolute; left:0;top:0;"
	CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
	type="application/x-oleobject">
	
	<PARAM NAME="URL" VALUE="your file or url">
	<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">
	<PARAM NAME="AutoStart" VALUE="True">
	<PARAM name="uiMode" value="none">
	<PARAM name="PlayCount" value="9999">
</OBJECT>
obj = document.getElementById("VIDEO");

SCRIPTING control Code Parameters Description
obj.Settings.autoStart true Specifies or retrieves a value indicating whether the current media item begins playing automatically.
obj.Settings.baseURL Specifies the base URL used for relative path resolution with URL script commands that are embedded in media items.
ClosedCaption.captioningID 0 Specifies the name of the element displaying the captioning.
obj.Controls.currentMarker 0 Specifies the current marker number.
obj.Controls.currentPosition 0 Specifies the current position in the media item in seconds.
obj.Settings.defaultFrame - Specifies the name of the frame used to display a URL.
obj.enableContextMenu true Specifies a value indicating whether to enable the context menu, which appears when the right mouse button is clicked.
obj.enabled false Specifies whether the Windows Media Player control is enabled.
obj.fullScreen false Specifies whether video content is played back in full-screen mode.
obj.Settings.invokeURLs true Specifies a value indicating whether URL events should launch a Web browser.
obj.Settings.mute false Specifies if audio is muted.
obj.Settings.PlayCount 1 Specifies the number of times a media item will play. Minimum value of one.
obj.Settings.rate 1.0 Specifies the playback rate.
0.5 equates to half the normal playback speed, 2 equates to twice.
obj.stretchToFit false Specifies whether video displayed by the control automatically sizes to fit the video window, when the video window is larger than the dimensions of the video image.
obj.uiMode full Specifies which controls are shown in the user interface.
Possible values: invisible, none, mini, full.
obj.URL - Specifies the name of the media item to play.
You can specify a local filename or a URL.
obj.Settings.volume Last setting Zero specifies no volume and 100 specifies full volume.
obj.Settings.balance false Set balance between left and right speakers. 0 is egual, -100 is full left and 100 is full right.
obj.windowlessVideo false Specifies or retrieves a value indicating whether the Windows Media Player control renders video in windowless mode.
When windowlessVideo is set to true, the Player control renders video directly in the client area, so you can apply special effects or layer the video with text.
Supported by Windows Media Player for Windows XP or later.

that look great.
but can you tell me where to set it in?
shall it all go to body or???

that look great.
but can you tell me where to set it in?
shall it all go to body or???

The topmost code is hard coded html meaning it is html;
the second one is a scripting syntax meaning it has to go inside the <script> tag.
That line will store reference to the player object in the variable named obj there.
Now obj is the public name of the player - from now one you call it "obj" and it will respond.

The rest is scripting handles that you can use to manipulate your player.
the most important one is: [your player].URL part. With it you specify the file to play.
declaring: obj.URL = "myvideo.wmv" will switch from previous to playing myvideow.wmv file.

etc etc

ok... but all i need is a fullscreen button.
and a start,stop and pause button.
and im not good to this so if you just could tell me what i shall place where it would help a lot.
so what to place in "head" and what to place in "body"
so it give that i told i need.

This is interesting ....[?!?] still haven't found anything working for you on internet?!

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Windows Media Player</title>
	<style type="text/css">
	#Player,
	input{width:400px;}
	p input{width:97px}
	</style>
</head>
<body>
<INPUT TYPE="File"   VALUE="Megamix.mp3"	onChange="Player.URL = this.value">
<p>
<INPUT TYPE="BUTTON" VALUE="Play"		OnClick="Player.controls.play()">
<INPUT TYPE="BUTTON" VALUE="Stop"		OnClick="Player.controls.stop()">
<INPUT TYPE="BUTTON" VALUE="Pause"		OnClick="Player.controls.pause()">
<INPUT TYPE="BUTTON" VALUE="Full Screen"	OnClick="if (Player.playState == 3) 
Player.fullScreen = 'true'">
</p>
<p></p>

    <SCRIPT type="text/javascript">
      if(-1 != navigator.userAgent.indexOf("MSIE"))
      {
        document.write('<OBJECT id="Player"');
        document.write(' classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"');
        document.write(' width=300 height=200></OBJECT>');
      }
      else if(-1 != navigator.userAgent.indexOf("Firefox"))
      {
        document.write('<OBJECT id="Player"'); 
        document.write(' type="application/x-ms-wmp"'); 
        document.write(' width=300 height=200></OBJECT>');
      }    
    </SCRIPT>
</body>
</html>

1. that looks perfect.
2. can you do so the upload thing disapear and it play from a file uploaded to my website?
something like:

<INPUT TYPE="URL" VALUE="http://mywebsite.dk/music/mymusic.mp3"

im not good to that stuff but can u make something like that?

can you do so the upload thing disapear

Yes, you simply delete it!

and it play from a file uploaded to my website?

Just change the play button code from: <INPUT TYPE="BUTTON" VALUE="Play" OnClick="Player.controls.play()"> into: <INPUT TYPE="BUTTON" VALUE="Play" OnClick="Player.URL='http://mywebsite.dk/music/mymusic.mp3'>

that dont work but this work:

<INPUT TYPE="BUTTON" VALUE="Play" OnClick="Player.URL='http://mysite.my/mymusic/mysong.mp3'">
<INPUT TYPE="BUTTON" VALUE="Stop" onclick="Player.controls.stop()">
<INPUT TYPE="BUTTON" VALUE="Pause" onclick="Player.controls.pause()">
<INPUT TYPE="BUTTON" VALUE="Full Screen" onclick="if(Player.playState == 3) Player.fullScreen = 'true'">

<script type="text/javascript">

if(-1 != navigator.userAgent.indexOf("MSIE"))

{

document.write('<OBJECT id="Player"');

document.write(' classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"');

document.write(' width=300 height=200></OBJECT>');

}

else if(-1 != navigator.userAgent.indexOf("Firefox"))

{

document.write('<OBJECT id="Player"');

document.write(' type="application/x-ms-wmp"');

document.write(' width=300 height=200></OBJECT>');

}

</script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.