Group:  English: Entertainment ยป microsoft.public.windowsmedia.sdk
Thread: Rotation of video/audio files

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Rotation of video/audio files
heebie 05.07.2007 18:48:02
Hi

If I embed a windows media control in my web page, and create a playlist of
two items to play: the first advertising, and the second the main feature; is
there any way to make the first item rotate between a set of say four
adverts. So each time the control was loaded a different advert would be
played at the beginning?

Cheers

heebie
Re: Rotation of video/audio files
"Alessandro Angeli" <nobody[ at ]nowhere.in.the.net> 05.07.2007 20:08:51
From: "heebie"

[Quoted Text]
> If I embed a windows media control in my web page, and
> create a playlist of two items to play: the first
> advertising, and the second the main feature; is there
> any way to make the first item rotate between a set of
> say four adverts. So each time the control was loaded a
> different advert would be played at the beginning?

AFAIK you have 2 choices:

1. make the first entry point to a server-side script that
returns a different clip each time

2. (easier) do not open the playlist in the embedded player
but use client-side scripting in the page to open the first
clip choosing the one you want then, when done playing, open
the second one

--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm


Re: Rotation of video/audio files
"Neil Smith [MVP Digital Media]" <neil[ at ]nospam.com> 05.07.2007 21:56:52
On Thu, 5 Jul 2007 11:48:02 -0700, heebie
<heebie[ at ]discussions.microsoft.com> wrote:

[Quoted Text]
>Hi
>
>If I embed a windows media control in my web page, and create a playlist of
>two items to play: the first advertising, and the second the main feature; is
>there any way to make the first item rotate between a set of say four
>adverts. So each time the control was loaded a different advert would be
>played at the beginning?


Just dynamically generate your ASX file from a database and scripting
language such as C#, Perl or PHP. It's a simple enough structure that
you can just use string building rather than bother with an XML parser

The ASX playlist syntax is here :
http://msdn2.microsoft.com/en-us/library/ms910265.aspx

A typical example of usage might be
http://www.wdvl.com/Multimedia/Windows_Media/media3_1.html


Cheers - Neil
------------------------------------------------
Digital Media MVP : 2004-2007
http://mvp.support.microsoft.com/mvpfaqs
Re: Rotation of video/audio files
heebie 06.07.2007 12:00:02


"Neil Smith [MVP Digital Media]" wrote:

[Quoted Text]
> On Thu, 5 Jul 2007 11:48:02 -0700, heebie
> <heebie[ at ]discussions.microsoft.com> wrote:
>
> >Hi
> >
> >If I embed a windows media control in my web page, and create a playlist of
> >two items to play: the first advertising, and the second the main feature; is
> >there any way to make the first item rotate between a set of say four
> >adverts. So each time the control was loaded a different advert would be
> >played at the beginning?
>
>
> Just dynamically generate your ASX file from a database and scripting
> language such as C#, Perl or PHP. It's a simple enough structure that
> you can just use string building rather than bother with an XML parser
>
> The ASX playlist syntax is here :
> http://msdn2.microsoft.com/en-us/library/ms910265.aspx
>
> A typical example of usage might be
> http://www.wdvl.com/Multimedia/Windows_Media/media3_1.html
>
>
> Cheers - Neil
> ------------------------------------------------
> Digital Media MVP : 2004-2007
> http://mvp.support.microsoft.com/mvpfaqs
>

Neil

I think the ASX solution you pointed to was great. However, I just need to
clarify a few things.

Firstly, say I uploaded a video every day and I wanted advertising before
each one. In my asx file the second entry would point to my main content
(.wmv or whatever) but what would I point the first entry to? Another asx
file which would dynamically select one video out of four?

Secondly, I uploaded a test at http://www.heebie.co.uk/video/video.html .
Why do the controls disappear after a second, and how come my advertising
banner isn't showing (or does that only work with the stand alone player?)

Thanks,

heebie
Re: Rotation of video/audio files
"Neil Smith [MVP Digital Media]" <neil[ at ]nospam.com> 07.07.2007 16:20:04
On Fri, 6 Jul 2007 05:00:02 -0700, heebie
<heebie[ at ]discussions.microsoft.com> wrote:

[Quoted Text]
>
>
>"Neil Smith [MVP Digital Media]" wrote:
>
>> On Thu, 5 Jul 2007 11:48:02 -0700, heebie
>> <heebie[ at ]discussions.microsoft.com> wrote:
>>
>> >Hi
>> >
>> >If I embed a windows media control in my web page, and create a playlist of
>> >two items to play: the first advertising, and the second the main feature; is
>> >there any way to make the first item rotate between a set of say four
>> >adverts. So each time the control was loaded a different advert would be
>> >played at the beginning?
>>
>>
>> Just dynamically generate your ASX file from a database and scripting
>> language such as C#, Perl or PHP. It's a simple enough structure that
>> you can just use string building rather than bother with an XML parser
>>
>> The ASX playlist syntax is here :
>> http://msdn2.microsoft.com/en-us/library/ms910265.aspx
>>
>> A typical example of usage might be
>> http://www.wdvl.com/Multimedia/Windows_Media/media3_1.html

>I think the ASX solution you pointed to was great. However, I just need to
>clarify a few things.
>
>Firstly, say I uploaded a video every day and I wanted advertising before
>each one. In my asx file the second entry would point to my main content
>(.wmv or whatever) but what would I point the first entry to? Another asx
>file which would dynamically select one video out of four?

There's no need to create a second ASX, you should be able to use your
scripting language to create the ASX on the fly, it's only a text
string really. So each time the ASX was requested, you would write a
random ad URL from your (4) ads.

In PHP for example, you would typically write a line which did

$ad_list = array(
0 => 'advert-1.wmv',
1 => 'second_advert.wmv',
2 => 'my_3rd_ad.wmv',
3 => 'buy_our_stuff.wmv'
);

$random_index = rand(0,3);
$ad_base_url = 'http://yourserver.com/video/ads/';
$media_base_url = 'http://yourserver.com/video/';
$random_ad = $ad_base_url . $ad_list[$random_index];

$asx_content = '<asx version="3.0">
<entry>
<param name="showwhilebuffering" value="true" />
<param name="prebuffer" value="true" />
<ref href="' . $random_ad . '" />
</entry>
<entry>
<title>Markers Discussion</title>
<param name="prebuffer" value="true" />
<ref href="' . $media_base_url . 'feature_1.wmv" />
</entry>
</asx>';


>Secondly, I uploaded a test at http://www.heebie.co.uk/video/video.html .
>Why do the controls disappear after a second, and how come my advertising
>banner isn't showing (or does that only work with the stand alone player?)


Well a couple of things there :

Countdown_Yellow.wmv and TheEnd_Yellow.wmv are 2500kbps videos.

You shouldn't be over 150-250kbps for online use ever, as your viewers
are gonna be waiting a really long time on a 384kbps DSL connection
for example. Re-encode those down to about 250kbps for a 320x240 video
size.

The second thing is, yes the ad banner is a function of the standalone
player version 7-11 embedding code although you're using media player
6.4 activeX. So people with more modern machines simply won't see it.

That image videobanner.gif doesn't exist anyway under
/videos/videobanner.gif URL (404 error) although the logo image
videobann.gif does, and is displayed in WMP6.4

Remember that any relative URLs in the ASX will be relative to the
location of the asx file, not to the site root.

You could reasonably rotate that banner image within the page for each
page view, using a similar script to the one used to build the ASX
playlist

HTH
Cheers - Neil
------------------------------------------------
Digital Media MVP : 2004-2007
http://mvp.support.microsoft.com/mvpfaqs
Re: Rotation of video/audio files
heebie 07.07.2007 19:32:03


"Neil Smith [MVP Digital Media]" wrote:

[Quoted Text]
> On Fri, 6 Jul 2007 05:00:02 -0700, heebie
> <heebie[ at ]discussions.microsoft.com> wrote:
>
> >
> >
> >"Neil Smith [MVP Digital Media]" wrote:
> >
> >> On Thu, 5 Jul 2007 11:48:02 -0700, heebie
> >> <heebie[ at ]discussions.microsoft.com> wrote:
> >>
> >> >Hi
> >> >
> >> >If I embed a windows media control in my web page, and create a playlist of
> >> >two items to play: the first advertising, and the second the main feature; is
> >> >there any way to make the first item rotate between a set of say four
> >> >adverts. So each time the control was loaded a different advert would be
> >> >played at the beginning?
> >>
> >>
> >> Just dynamically generate your ASX file from a database and scripting
> >> language such as C#, Perl or PHP. It's a simple enough structure that
> >> you can just use string building rather than bother with an XML parser
> >>
> >> The ASX playlist syntax is here :
> >> http://msdn2.microsoft.com/en-us/library/ms910265.aspx
> >>
> >> A typical example of usage might be
> >> http://www.wdvl.com/Multimedia/Windows_Media/media3_1.html
>
> >I think the ASX solution you pointed to was great. However, I just need to
> >clarify a few things.
> >
> >Firstly, say I uploaded a video every day and I wanted advertising before
> >each one. In my asx file the second entry would point to my main content
> >(.wmv or whatever) but what would I point the first entry to? Another asx
> >file which would dynamically select one video out of four?
>
> There's no need to create a second ASX, you should be able to use your
> scripting language to create the ASX on the fly, it's only a text
> string really. So each time the ASX was requested, you would write a
> random ad URL from your (4) ads.
>
> In PHP for example, you would typically write a line which did
>
> $ad_list = array(
> 0 => 'advert-1.wmv',
> 1 => 'second_advert.wmv',
> 2 => 'my_3rd_ad.wmv',
> 3 => 'buy_our_stuff.wmv'
> );
>
> $random_index = rand(0,3);
> $ad_base_url = 'http://yourserver.com/video/ads/';
> $media_base_url = 'http://yourserver.com/video/';
> $random_ad = $ad_base_url . $ad_list[$random_index];
>
> $asx_content = '<asx version="3.0">
> <entry>
> <param name="showwhilebuffering" value="true" />
> <param name="prebuffer" value="true" />
> <ref href="' . $random_ad . '" />
> </entry>
> <entry>
> <title>Markers Discussion</title>
> <param name="prebuffer" value="true" />
> <ref href="' . $media_base_url . 'feature_1.wmv" />
> </entry>
> </asx>';
>
>
> >Secondly, I uploaded a test at http://www.heebie.co.uk/video/video.html .
> >Why do the controls disappear after a second, and how come my advertising
> >banner isn't showing (or does that only work with the stand alone player?)
>
>
> Well a couple of things there :
>
> Countdown_Yellow.wmv and TheEnd_Yellow.wmv are 2500kbps videos.
>
> You shouldn't be over 150-250kbps for online use ever, as your viewers
> are gonna be waiting a really long time on a 384kbps DSL connection
> for example. Re-encode those down to about 250kbps for a 320x240 video
> size.
>
> The second thing is, yes the ad banner is a function of the standalone
> player version 7-11 embedding code although you're using media player
> 6.4 activeX. So people with more modern machines simply won't see it.
>
> That image videobanner.gif doesn't exist anyway under
> /videos/videobanner.gif URL (404 error) although the logo image
> videobann.gif does, and is displayed in WMP6.4
>
> Remember that any relative URLs in the ASX will be relative to the
> location of the asx file, not to the site root.
>
> You could reasonably rotate that banner image within the page for each
> page view, using a similar script to the one used to build the ASX
> playlist
>
> HTH
> Cheers - Neil
> ------------------------------------------------
> Digital Media MVP : 2004-2007
> http://mvp.support.microsoft.com/mvpfaqs
>

Thanks very much for another informative answer. In the ideal situation, my
users would put a script at the top of their page which would automatically
add advertising to any windows media embed control on that page. I don't want
them to create a new php (asx, php, whatever it may be) every time they embed
a new movie. It's a shame you can't create playlists on the fly with the
embed control.

Thanks again for your time. I really appreciate it.
Re: Rotation of video/audio files
heebie 12.07.2007 18:22:01


"heebie" wrote:

[Quoted Text]
>
>
> "Neil Smith [MVP Digital Media]" wrote:
>
> > On Fri, 6 Jul 2007 05:00:02 -0700, heebie
> > <heebie[ at ]discussions.microsoft.com> wrote:
> >
> > >
> > >
> > >"Neil Smith [MVP Digital Media]" wrote:
> > >
> > >> On Thu, 5 Jul 2007 11:48:02 -0700, heebie
> > >> <heebie[ at ]discussions.microsoft.com> wrote:
> > >>
> > >> >Hi
> > >> >
> > >> >If I embed a windows media control in my web page, and create a playlist of
> > >> >two items to play: the first advertising, and the second the main feature; is
> > >> >there any way to make the first item rotate between a set of say four
> > >> >adverts. So each time the control was loaded a different advert would be
> > >> >played at the beginning?
> > >>
> > >>
> > >> Just dynamically generate your ASX file from a database and scripting
> > >> language such as C#, Perl or PHP. It's a simple enough structure that
> > >> you can just use string building rather than bother with an XML parser
> > >>
> > >> The ASX playlist syntax is here :
> > >> http://msdn2.microsoft.com/en-us/library/ms910265.aspx
> > >>
> > >> A typical example of usage might be
> > >> http://www.wdvl.com/Multimedia/Windows_Media/media3_1.html
> >
> > >I think the ASX solution you pointed to was great. However, I just need to
> > >clarify a few things.
> > >
> > >Firstly, say I uploaded a video every day and I wanted advertising before
> > >each one. In my asx file the second entry would point to my main content
> > >(.wmv or whatever) but what would I point the first entry to? Another asx
> > >file which would dynamically select one video out of four?
> >
> > There's no need to create a second ASX, you should be able to use your
> > scripting language to create the ASX on the fly, it's only a text
> > string really. So each time the ASX was requested, you would write a
> > random ad URL from your (4) ads.
> >
> > In PHP for example, you would typically write a line which did
> >
> > $ad_list = array(
> > 0 => 'advert-1.wmv',
> > 1 => 'second_advert.wmv',
> > 2 => 'my_3rd_ad.wmv',
> > 3 => 'buy_our_stuff.wmv'
> > );
> >
> > $random_index = rand(0,3);
> > $ad_base_url = 'http://yourserver.com/video/ads/';
> > $media_base_url = 'http://yourserver.com/video/';
> > $random_ad = $ad_base_url . $ad_list[$random_index];
> >
> > $asx_content = '<asx version="3.0">
> > <entry>
> > <param name="showwhilebuffering" value="true" />
> > <param name="prebuffer" value="true" />
> > <ref href="' . $random_ad . '" />
> > </entry>
> > <entry>
> > <title>Markers Discussion</title>
> > <param name="prebuffer" value="true" />
> > <ref href="' . $media_base_url . 'feature_1.wmv" />
> > </entry>
> > </asx>';
> >
> >
> > >Secondly, I uploaded a test at http://www.heebie.co.uk/video/video.html .
> > >Why do the controls disappear after a second, and how come my advertising
> > >banner isn't showing (or does that only work with the stand alone player?)
> >
> >
> > Well a couple of things there :
> >
> > Countdown_Yellow.wmv and TheEnd_Yellow.wmv are 2500kbps videos.
> >
> > You shouldn't be over 150-250kbps for online use ever, as your viewers
> > are gonna be waiting a really long time on a 384kbps DSL connection
> > for example. Re-encode those down to about 250kbps for a 320x240 video
> > size.
> >
> > The second thing is, yes the ad banner is a function of the standalone
> > player version 7-11 embedding code although you're using media player
> > 6.4 activeX. So people with more modern machines simply won't see it.
> >
> > That image videobanner.gif doesn't exist anyway under
> > /videos/videobanner.gif URL (404 error) although the logo image
> > videobann.gif does, and is displayed in WMP6.4
> >
> > Remember that any relative URLs in the ASX will be relative to the
> > location of the asx file, not to the site root.
> >
> > You could reasonably rotate that banner image within the page for each
> > page view, using a similar script to the one used to build the ASX
> > playlist
> >
> > HTH
> > Cheers - Neil
> > ------------------------------------------------
> > Digital Media MVP : 2004-2007
> > http://mvp.support.microsoft.com/mvpfaqs
> >
>
> Thanks very much for another informative answer. In the ideal situation, my
> users would put a script at the top of their page which would automatically
> add advertising to any windows media embed control on that page. I don't want
> them to create a new php (asx, php, whatever it may be) every time they embed
> a new movie. It's a shame you can't create playlists on the fly with the
> embed control.
>
> Thanks again for your time. I really appreciate it.

Is there a way to have php create the playlist on the embed page and then
use its output as the thing that the embed code plays?
Re: Rotation of video/audio files
"Neil Smith [MVP Digital Media]" <neil[ at ]nospam.com> 12.07.2007 21:36:28
On Thu, 12 Jul 2007 11:22:01 -0700, heebie
<heebie[ at ]discussions.microsoft.com> wrote:


[Quoted Text]
>> Thanks very much for another informative answer. In the ideal situation, my
>> users would put a script at the top of their page which would automatically
>> add advertising to any windows media embed control on that page. I don't want
>> them to create a new php (asx, php, whatever it may be) every time they embed
>> a new movie. It's a shame you can't create playlists on the fly with the
>> embed control.
>>
>> Thanks again for your time. I really appreciate it.
>
>Is there a way to have php create the playlist on the embed page and then
>use its output as the thing that the embed code plays?


The most frequent way PHP is used is to output HTML to a web browser.

I'm not sure if you're asking if you can create the web page using PHP
(you can, but there might be no advantage if all it does is load a
single dynamic-ad playlist). Or are you asking if there's a
passthrough for PHP to "send" the actual windows media file ?

You can use readfile() to do that, but it's really the job of the web
server rather than a scripting language to offer simple file downloads
like that - i.e. there's no need to invoke PHP when all you're doing
is referencing a file in a web server's directory structure.

HTH
Cheers - Neil
------------------------------------------------
Digital Media MVP : 2004-2007
http://mvp.support.microsoft.com/mvpfaqs

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net