Partager via


Using Wallclock Scheduling in WMS to start a broadcast at a specific time

Over the years I've talked to a number of people that want to broadcast a live video at a certain time of day.  Usually this is in a corporate network where a CEO is doing a large broadcast to the entire company or something similar that needs to happen at a specific time without the intervention of a WMS admin.  One of the features that comes with WMS starting in Windows 2003 SP1 is wallclock scheduling .  This gives you the ability within a server side playlist to trigger an event to take place at a specific time.

 I'll detail two examples of how you can schedule a broadcast.  The first one below loops through the three videos indefinitely in the second priority class called "od" until the higher priority "live" priority class fires off at 5:41 PM.  This may seem a little out of order, but the way this works is that because "live" is listed above "od" the first priority class would normally play first.  However, with the wallclock tag set to begin at a specific time "live" will not start until that time.  So the server plays the lower priority "od" until "live" hits it's wallclock scheduled time.

<?wsx version="1.0" encoding="utf-8"?>
<smil>
    <excl>
        <priorityClass id="live" lower="pause">
            <media src="https://encodermachine:8080" begin="wallclock(17:41:00)"/>
        </priorityClass>
        <priorityClass id="od">
            <seq repeatCount="indefinite" begin="0s">
                <media src="C:\wmpub\WMRoot\snowboard_300.wmv"/>
                <media src="C:\wmpub\WMRoot\powered_by_300.wmv"/>
                <media src="C:\wmpub\WMRoot\racecar_100.wmv"/>
            </seq>
        </priorityClass>
    </excl>
</smil>

 There are times when you don't actually want to stream data the entire time you're waiting for the broadcast.  You could throw up a banner video that says, "This video will not play until 5:41 PM" and put some groovy music behind it but the network admin is likely going to wonder why you've been chewing up bandwidth hours before the broadcast.  So instead you may just want to start the broadcast at 5:41.  You'd think you could delete the "od" priority class and just use the one "live" one to start whenever it's scheduled for.  However, there's a requirement in WMS that when a publishing point starts it actually has to play something.  Not indefinitely, but it does need to successfully see bits going through the pipeline.  So what you do instead is something like this:

<?wsx version="1.0" encoding="utf-8"?>
<smil>
    <excl>
        <priorityClass id="live" lower="pause">
            <media src=https://encodermachine:8080 begin="wallclock(17:41:00)"/>
        </priorityClass>
        <priorityClass id="od">
            <seq begin="0s">
                <media src="C:\wmpub\WMRoot\pinball.wmv"/>
            </seq>
        </priorityClass>
    </excl>
</smil>

Note that all that really happened was that I removed the repeatCount.  I changed the "od" priority class to be just the one short pinball.wmv, but that's only because it's the shortest of the sample clips.  So what happens is that when the publishing point starts pinball.wmv would play to the end.  If you have a client connect as soon as the publishing point starts they will see pinball play and then a black screen.  The client may timeout after a couple of minutes because no data is actually being sent.  The publishing point won't start sending data until lthe wallclock scheduled time.  At that point clients can connect and view the live stream.