Advertisement Support in SMFv2

Aug 4, 2010 at 6:21 PM

I've been trying to get a simple pre-roll and post-roll ad to run on smfv2, and seem to have hit a dead end. The ad doesn't seem to play at all. Here's some sample code that I've been trying.

Also, are there any resources/samples other than the api documentation that can help with using the Advertisement features in smf2. 

this.newsPlayer.AutoPlay = True;

this.newsPlayer.BufferingTime = new TimeSpan(0, 0, 5);
this.newsPlayer.Playlist.Add(new PlaylistItem()
  MediaSource = new Uri(""),
  DeliveryMethod = DeliveryMethods.ProgressiveDownload,
  PreRollAdvertisement = new Advertisement()
            AdSource = new Uri(""),
            Duration = new TimeSpan(0,0,20),
            DeliveryMethod = DeliveryMethods.ProgressiveDownload,
            StartTime = new TimeSpan (0,0,5)
Aug 4, 2010 at 10:29 PM

I believe you may have found a bug. I also could not get this to work either.

However, after experimenting a bit I was able to narrow down the bug. If the PlaylistItem is AdaptiveStreaming, as in a Smooth Streaming presentation, the ad worked perfectly. It seems that playlist items that are progressive download do not currently support ads.


Aug 5, 2010 at 7:46 PM
Edited Aug 5, 2010 at 7:51 PM

Thanks Nick. Are you sure this is a bug, and not something I've missed out in the code? 

If its a bug, is there a workaround I can use? Pre-roll, and post-roll ads are a very essential part of what I'm currently doing, and the server I;'m using to deliver content provides media as mp4 files, so I believe Adaptive streaming would not work.

Also, what I asked in my earlier post, are there any resources/samples other than the api documentation that can help with using the Advertisement features in smf2. 

Aug 6, 2010 at 5:12 PM
Edited Aug 6, 2010 at 5:13 PM

I am fairly certain this is a bug, unless it was intentionally put there by the developers. One thing that didn't work for me in your code was the last line (this.newsPlayer.GoToPlaylistItem(0)).

The only other thing I changed in your code besides removing the last line for it to work was changing the DeliveryMethod to AdaptiveStreaming, and changing the source to a Smooth Streaming video.

As far as samples, krohling posted something on Twitter yesterday about writing plugin examples for SMF. Maybe you could hit him up about it on there.

Aug 9, 2010 at 1:32 PM
I hit the issue myself, and I am pretty sure this is not a "bug". AdScheduling is not currently supported on Media Framework with progressive download contents, as seen in the source code: /// <summary> /// Gets whether this plugin supports ad scheduling. /// </summary> public bool SupportsAdScheduling { get { return false; } } and public IAdContext ScheduleAd(Uri adSource, DeliveryMethods deliveryMethod, TimeSpan? duration = null, TimeSpan? startTime = null, Uri clickThrough = null, bool pauseTimeline = true, IAdContext appendToAd = null, object data = null) { throw new NotImplementedException(); } I'ts a piece of code required in my current projet, so I will maybe suggest an implementation. (If a manage to find enough time to do it, that is ;) )
Aug 16, 2010 at 6:33 PM

Hey guys, sorry for joining this thread a bit late.  As Laere has pointed out this is not a bug.  SMF does not implement any of it's own advertising logic it leverages the support baked into the SmoothStreamingMediaElement.  Unfortunately the standard MediaElement does not support advertising.  That being the case we there is unfortunately no advertising support when using the ProgressiveMediaPlugin.

Oct 3, 2011 at 4:49 PM

Hello guys,

I set that parameter inside of object to get the same result as the following code?


		PreRollAdvertisement = new Advertisement()
                    AdSource = new Uri("http://<servername>/Video/<videoname>.ism/Manifest"),
                    Duration = new TimeSpan(0, 0, 20),
                    DeliveryMethod = DeliveryMethods.AdaptiveStreaming,
                    StartTime = new TimeSpan(0, 0, 5)

I wrote the parameter:

<param name="PreRollAdvertisement" value="AdSource=http://<servername>/Video/<videoadvname>.ism/Manifest" />

but does not work! 

I want to see ads from param and not by code, can you help?