Jump to content
Sign in to follow this  
jazo10

asx player?

Recommended Posts

SORRY! diddnt realise this was in the wrong catagory, ill post it in the other one.... admin please delete :">

i was wondering, i am making a player for streaming media....

before anyone says it... NO! i dont want to just use winamp! :( i have a webpage, and i want to make a simple program to play an asx file, tell how long it has been connected for... and the status of the stream.... ie... connecting,playing,buffering,stoped....

i have tried soundplay() diddnt expect it to work anywayz... but it was worth a try :(

so yeah back to the question... anyone know of a way to do this?

even an external DLL would be fine....

thanks in advance

____

Jazo

Edited by jazo10

Share this post


Link to post
Share on other sites

if i'm correct MCI commands can read a audio and video stream.

look for the mcisendsctring on the forum(like in my mediaplayer topic) and look on msdn for mci commands to send with it.


*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...

Share this post


Link to post
Share on other sites

hmmm :(

i cant seem to find it

i have tried using that code of Zero's but i dont see the point in using the player for thoes files... because sound play works for them

Share this post


Link to post
Share on other sites

I don't now if it works but maybe you can use this...

It's a HTML code but maybe... :(

<HTML>
<HEAD>
<TITLE>Doc Javascript's Streaming Media JukeBox</TITLE>
<script LANGUAGE = "Javascript">
var streams = new Array();
streams[0] = new makeStream("mms://streampower.belgacom.be/donnalow", "Radio Donna");
streams[1] = new makeStream("http://stubru.be/intermodus/overige/stubrulive_low.asx", "Studio Brussel");
streams[2] = new makeStream("http://www.c-dance.be/cdance-low.asx", "C-Dance");
streams[3] = new makeStream("http://cinecast.capcave.com/streams/SkyRadio/SkyRadio.asx", "Sky Radio");

function bName() {
  if (navigator.appName == "Microsoft Internet Explorer")
    return 1;
  if (navigator.appName == "Netscape")
    return 2;
  return 0;
}

function bVer() {
  // return version number (e.g., 4.03)
  return parseFloat(navigator.appVersion)
}

var nameCode = bName();
var versionCode = bVer();
var mac = (navigator.userAgent.indexOf("Mac")!=-1);
var activeX = (nameCode == 1 && versionCode >= 4.0) ? true : false; 

function makeStream(url, name) {
    this.url = url;
    this.name = name;
}

function setShowControls(flag) {
  if (activeX)
    document.mediaPlayer.showControls = flag
  else
    document.mediaPlayer.SetShowControls(flag);
}

function getShowControls() {
  if (activeX)
    return document.mediaPlayer.showControls;
  else
    return document.mediaPlayer.GetShowControls();
}

function getPlayState() {
  if (activeX)
    return document.mediaPlayer.playState
  else
    return document.mediaPlayer.GetPlayState();
}

function setDisplaySize(size) {
  if (activeX)
    document.mediaPlayer.displaySize = size
  else
    document.mediaPlayer.SetDisplaySize(size);
}

function setFileName(url) {
  if (activeX)
    document.mediaPlayer.fileName = url
  else
    document.mediaPlayer.SetFileName(url);
}

function handleControlsOnOffClick() {
  if (getShowControls() == true) {
    setShowControls(false);
    document.displayMode.controls.value = "  Show Controls ";
  }
  else {
    setShowControls(true);
    document.displayMode.controls.value = "  Hide Controls "
  }
}

function handlePlayOrPauseClick(){
  var state;
  playerStatus = getPlayState();
  if (playerStatus == 6) {
    document.mediaPlayer.Play();
    document.displayMode.playOrPause.value = " Pause ";
  } 
  else if (playerStatus == 1) {
    document.mediaPlayer.Play();
    document.displayMode.playOrPause.value = " Pause ";
  } 
  else if (playerStatus == 2) {
    document.mediaPlayer.Pause();
    document.displayMode.playOrPause.value = " Play  ";
  }
} 

function change() {
  var list = document.playerCtrl.streams;
  var streamURL = list.options[list.selectedIndex].value;
  document.mediaPlayer.Stop();
  document.displayMode.playOrPause.value = " Pause ";
  setFileName(streamURL);
}

</SCRIPT>
</HEAD>
<BODY LEFTMARGIN = "100">
<h3>Doc Javascript's Streaming Media JukeBox</h3><P><P><HR><P>
<script LANGUAGE="Javascript">
with (document) {
  writeln('<OBJECT');
  writeln('  ID="mediaPlayer"');  
  writeln('  CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"');
  writeln(
 'CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"');
  writeln('  STANDBY="Loading Microsoft Windows Media Player components..."');
  writeln('  TYPE="application/x-oleobject">');
  writeln('<PARAM NAME="fileName" VALUE="http://msdn.microsoft.com/downloads/samples/Internet/imedia/netshow/smedia/NS3/Javascript/Buttons/control.asx">');
  writeln('<PARAM NAME="animationatStart" VALUE="true">');
  writeln('<PARAM NAME="transparentatStart" VALUE="true">');
  writeln('<PARAM NAME="autoStart" VALUE="true">');
  writeln('<PARAM NAME="showControls" VALUE="true">');
  writeln('<EMBED TYPE="application/x-mplayer2"');
  writeln('  PLUGINSPAGE="http://microsoft.com/windows/mediaplayer/en/download/"');
  writeln('  ID=mediaPlayer');
  writeln('  NAME="mediaPlayer"');
  writeln('  DISPLAYSIZE="4"');     // Fit To Size
  writeln('  AUTOSIZE="-1"');
  writeln('  BGCOLOR="darkblue"');
  writeln('  SHOWCONTROLS="-1" ');
  writeln('  SHOWTRACKER="-1"');
  writeln('  SHOWDISPLAY="0"');
  writeln('  SHOWSTATUSBAR="-1"');
  writeln('  VIDEOBORDER3D="-1"');
  writeln('  WIDTH=320');
  writeln('  HEIGHT=313');
 writeln('SRC="http://msdn.microsoft.com/downloads/samples/Internet/imedia/netshow/smedia/NS3/Javascript/Buttons/control.asx"')
  writeln('  AUTOSTART="-1" ');
  writeln('  DESIGNTIMESP="5311"');
  writeln('  >');
  writeln('</EMBED>');
  writeln('</OBJECT><P>');
  writeln('<FORM NAME="playerCtrl">');
  writeln('<SELECT NAME="streams" onchange="change()">');
  for (var i = 0; i < streams.length; i++) {
    writeln('  <OPTION VALUE="', streams[i].url, '">', streams[i].name);
  }
  writeln('</SELECT>');
  writeln('</FORM>');
}
</SCRIPT>
<FORM NAME="displayMode">
<INPUT TYPE="button" VALUE=" Pause " NAME="playOrPause" onclick="handlePlayOrPauseClick()" STYLE = "font-family:courier">
<INPUT TYPE="button" VALUE="  Hide Controls " NAME="controls" onclick="handleControlsOnOffClick()" STYLE = "font-family:courier"><BR>
<INPUT TYPE="button" VALUE=" Small " NAME="small" onclick="setDisplaySize(1)" STYLE="font-family:courier">
<INPUT TYPE="button" VALUE=" Normal " NAME="normal" onclick="setDisplaySize(0)" STYLE="font-family:courier">
<INPUT TYPE="button" VALUE=" Large  " NAME="large" onclick="setDisplaySize(2)" STYLE="font-family:courier"><BR><BR>
</FORM>
</BODY>
</HTML>

Sapiente vince, rex, noli vincere ferro!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...