Re: Now playing Sources In Windows Media Encoder

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Neil Smith [MVP Digital Media] (neil_at_nospam.com)
Date: 11/27/04


Date: Sat, 27 Nov 2004 18:11:43 GMT

OK here's the plan : Its quite complicated so bear with me :

The encode has only one set of global settings for a broadcast, and so
they are carried through to the Media Server and shown as the playlist
information by the player.

So we have to be more clever than that. What I'm assuming is that you
have the following setup :

Source 1 DJ Azz (audio source) using video from eg webcam
Source 1 rolls over to Source 2 at end.

Source 2 Barney Boy (audio source)
Source 2 rolls over to Source 2 at end.

Source 3 Jarvinator (audio source)
Source 3 rolls over to first source at end.

And to go with that you've added a few attributes on the Attributes
Tab in the encoder to describe your playlist.

What you need to do is this : For each source, also choose the
'Script' checkbox, and select 'Script Panel'. This will activate a
small text box just under the encoder preview window for you to enter
script or text commands to the players connected to your broadcast.

When you enter a text command, it is sent along with the video/audio
data to the player, and you can then use Javascript to extract the
data and present it in the web page, which is what we're going to do
here.

You need to get your man to type in or better, cut+paste into the text
box at the start of each track in the mix. Make sure the Script
command box is set to the small white Speech Bubble for this code to
work. When you've entered your track name, press Insert once and it
will be sent to the players. The HTML page below will then display the
content of your script command (track name). Clear ? OK lets go :

Start Code Snippet ==================================

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
        <title>Untitled</title>
        
<script language="javascript1.2" type="text/javascript">
window.offScreenBuffering=true;

function setPlayerEvents() {
        WMP9=document.getElementById("mediaplayer");
        WMP9.attachEvent("ScriptCommand",setPlayerState);
}

function setPlayerState(commandtype,commandparam) {
        if (commandtype=='TEXT') {

document.getElementById("outputlayer").innerHTML=commandparam;
        }
}
</script>
<style type="text/css">
body {
        font-family: "Comic Sans MS", helvetica, sans-serif;
        background-color: #0033CC;
        color: #000000;
        text-align: center;
}
h1 {
        font-size: 18px;
        font-weight: normal;
        color: #FFFFFF;
        width: 100%;
        margin: 15px 0 5px 0;
        text-align: center;
}
th {
        font-size: 18px;
        width: 80px;
        text-align: left;
        vertical-align: middle;
}
td {
        color: #FF0000;
        font-size: 14px;
        text-align: left;
        vertical-align: middle;
}
img.massive {
        margin: 2px;
}
#content {
        background-color: #689ACB;
/* border-style: collapse; */
        border: 1px solid #000000;
        width: 470px;
        padding: 0px;
}
</style>

</head>
<body onload="setPlayerEvents()">

<object id="mediaplayer"
classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6"
type="application/x-oleobject" width="498" height="424">
        <param name="url" value="mms://win1.fast-serv.com/stumpcam" />
        <param name="autostart" value="1" />
        <param name="showcontrols" value="1" />
        <param name="uimode" value="mini" />
        <param name="stretchtofit" value="1" />
        <param name="enablecontextmenu" value="1" />
        <embed
          src="http://192.168.10.151:8080" width="498" height="424"
          autostart="1" type="application/x-mplayer2"
          pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"
          transparentatstart="0"
          animationatstart="0"
          showcontrols="0"
          autosize="0"
          displaysize="0"></embed>
</object>

<h1>Right Click To Zoom To Full Screen</h1>
<table id="content" cellspacing="2" cellpadding="2">
        <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td rowspan="4">
                        <img border="0"
src="../../../Archive%20Thumbnail.jpg" width="144" height="104"
alt="SCTV Station Massive" class="massive" />
                </td>
        </tr>
        <tr>
                <th scope="row">On air:</th>
                <td width="250">
                        <strong>SCTV Launch Night (Repeat)</strong>
                </td>
                <td>&nbsp;</td>
        </tr>
        <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
        </tr>
        <tr>
                <th scope="row">Music:</th>
                <td>
                        <div id="outputlayer">Finding tracks ...</div>
                </td>
        </tr>
</table>

</body>
</html>

End Code Snippet ==================================

OK So first you need to dump the frameset completely, save the page
as-is and drop it onto your web server in the same directory you're
using now.

The javascript in the HTML above will intercept the script commands
and place them in the DIV labelled <div id="outputlayer"> (it's inside
the stripped-down table I put in place). The script actually attaches
an event to the embedded media player, so that's why you've got a body
onload tag - its so the page is completely loaded before we try to
attach an event to something in the page.

I've also moved the player control version from 6.4 which you get with
an EMBED tag alone, to a proper OBJECT tag which you can use to get
the player control for media player 7-10 (the display should look more
like a chrome, now).

BTW There's also a lot less cruft in the webpage, you need to figure
out how to use CSS effectively (the <style> block at the top of the
page controls all the look & feel code).

HTH and happy playing -
Cheers, Neil

On Thu, 25 Nov 2004 11:47:02 -0800, "gocompletelynuts"
<gocompletelynuts@discussions.microsoft.com> wrote:

>I wonder if you could help me work out a way to produce now playing features
>on a website.
>Now what I want to do is be able to have the now playing update from the
>sources that go through a playlist I am currently encoding to this server.
>
>i.e. source 1 is DJ Azz playing Old Skool
>source 2 is DJ barney Boy playing Funky House.
>
>These are both playing on a loop in my media encoder but when you watch it
>just displays the playlist information not the actual source.
>
>Is this possible?
>
>Please check out my feed before you answer as this might help you understand
>the problem.
>
>http://www.stumpcam.co.uk/Launchers%20and%20players/FAST%20HOST%20SERVER%20PLAYERS/Prototype%20player%20window/player.htm
>
>At the moment all I can put under now playing is DJ's in rotation.
>
>I would be incredibly greatful if you could help me with this.
>
>Andy Aranaz



Relevant Pages

  • Re: Cant seem to control player buffer with javascript
    ... When the server says that it is playing the ... the players are 20 seconds behind the server. ... I don't have an encoder here, ... Fast start is designed to pump data to the player ...
    (microsoft.public.windowsmedia.player.web)
  • Re: sending data while streaming
    ... I would like to write a WMS script that sends data to a player while ... All I want is to send songs informations. ... You can use the WM Encoder to insert text script commands which are ...
    (microsoft.public.windowsmedia.sdk)
  • Re: Jazz Guitarist Pet Peeves from Jazz Guitar NY forum
    ... He spent his time playing the guitar since a small kid and I am sure worked very hard but in the end his personal life was just not together. ... I do think this is a shame but frankly it never seem to effect his playing to any great degree, but you wonder where he would have gone had this part of his life been better. ... I am thinking for me this is a personal bias since hack player that I am, as the tempo goes up I find I have to play whatever I can to get through the tune. ... He plays licks that he has played in the solo and typical PM lines a real craft and talent. ...
    (rec.music.makers.guitar.jazz)
  • Re: Wheres the soul?!?
    ... > SRV did play with dynamics. ... considered constantly overplaying and playing with little sensitivity (and ... I did study with a teacher who was a great player and teacher who had issues ... Stevie is a blues player and can't play over jazz changes. ...
    (rec.music.makers.guitar.jazz)
  • Re: Sampras would of found this era the hardest
    ... a splendid tennis player at that time. ... was greater than Mac, but Mac clearly was a better tennis player & far ... despite playing in modern game - but that doesn't mean he wouldn't beat ...
    (rec.sport.tennis)