Player freezes after calling Stop() method on DRMed content

Jun 30, 2010 at 9:23 PM

Hello,

Please sorry for my English in advance.

I'm trying to create a simple SL player based on SMF 2.0 that would be able to play DRM encrypted content (SS, On Demand Files). I have created a class that extends "SMFPlayer". In my class I have created a button that would stop content playback. Stop button calls "base.Stop()" method.

 

void MediaStopElement_Click(object sender, RoutedEventArgs e)
{
 base.Stop();
} 

 

Button works ok, playback stops, but:

1. When playing DRM'ed content (not SS) and clicking on stop button that raises SMFPlayer.Stop() method, PlayElement remains in Playing state (Pause is displayed). So, playback can't be started again by clicking on Play button, only action that can be taken is next/previous playlist item select or direct playlist item select from the playlist.

2. Another thing... when playing DRM'ed SS and clicking on stop button that raises SMFPlayer.Stop() event, player changes PlayElement's state, but click on the PlayElement raises an Exception:

Error: Unhandled Error in Silverlight Application Play is not allowed when there is no source set.   at Microsoft.Web.Media.SmoothStreaming.SmoothStreamingMediaElement.Play()
   at Microsoft.SilverlightMediaFramework.Plugins.SmoothStreaming.SmoothStreamingMediaPlugin.Play()
   at Microsoft.SilverlightMediaFramework.Core.SMFPlayer.Play()
   at Microsoft.SilverlightMediaFramework.Core.SMFPlayer.PlayElement_Click(Object sender, RoutedEventArgs e)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

 

It seems like stop event handler resets active media plugin`s source or something. Selecting item from the playlist directly does not work neither next/previous buttons do.

Is there something I'am doing wrong?

Thank you very much.

Coordinator
Jul 2, 2010 at 2:19 AM

Do you have an example stream that is public we could use for testing?

Jul 2, 2010 at 2:36 AM

#2. I wonder if this is realated to issues we had with SmoothStreaming and PlayReady drm. We tracked it down to the SmoothStreamingMediaElement was throwing an exception internally at the end of the stream. All the undrmed content would play just fine.  The exception caused the SmoothStreamingMediaElement source to become null and SMF v1.1 would get rather corrupted. It was extremely hard to track down since debugging isn't allowed when drm content is being played.

 

 

Jul 2, 2010 at 6:08 PM
Edited Jul 2, 2010 at 7:15 PM

Thank you very much for such a fast response.

Yes, sure. Please find the link below which you can use to see the problem.

http://sl.licensekeyserver.com/roman/demo/smf_2_0_gray/

First entry in a playlist is simple BigBuckBunny clip which works ok when you hit Stop(). Second clip... this is where magic starts :) try opening it, wait for a license to be delivered, try to hit stop and then start the playback again, or change the playlist item using controls (CTRL + ALT + L to show logs panel); these actions should raise exceptions which can be seen in the logs panel or/and browser error console.

 

 

Coordinator
Jul 8, 2010 at 6:06 PM

Hey Qch, sorry it took me a while to take a look at this.  It looks like you have a different player on that site now?

Jul 8, 2010 at 6:13 PM
Edited Jul 8, 2010 at 6:28 PM
Hello krohling, It's ok. No, that's the one that is built using SMF 2.0 RC1 and has problems after hitting stop button. Try opening second file from the playlist, wair for a license to deliver, click on a stop button and see if you will be able to make it play again by hitting Play button, or by clicking on a next/previous playlist items buttons. Thank you very much.
Coordinator
Jul 9, 2010 at 12:08 AM

I looked into this a bit, and while it's difficult to debug since I'm able to play back the DRM'd content on my end, I did look through the logging information.  Here's a screenshot of what I saw: http://smf.vertigo.com/files/qchdrmissue-screencapture.png  The line that says "Media Element Generated Log - Reason: MediaElementShutdown" may indicate an issue with the underlying SmoothStreamingMediaElement.  I recommend trying to reproduce this using just the SmoothStreamingMediaElement (outside of SMF) and see if you have the same results.  I am very interested in seeing what the cause of this issue is, unfortunately I have no DRM'd content to test with.

Jul 9, 2010 at 9:53 PM

Thank you, krohling. I'll post an update as soon as I will make some tests with SSME only.

Thank you again for your quick responses.

Jul 19, 2010 at 4:31 PM

Hello,

 

Built a simple SSME with latest DLL from the IIS Smooth Streaming Client. The result is the same, when clicking on the Stop button and calling Stop(), object seems to close and reset all settings :). If I try to click Play then, it raises an exception:

 

 

Error: Unhandled Error in Silverlight Application Play is not allowed when there is no source set.   at Microsoft.Web.Media.SmoothStreaming.SmoothStreamingMediaElement.Play()
   at SSMETest.MainPage.button2_Click(Object sender, RoutedEventArgs e)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)
Source File: http://sl.licensekeyserver.com/roman/smf/ssmetesttestpage.html
Line: 0

 

The app lies here: http://sl.licensekeyserver.com/roman/smf/ssmetesttestpage.html

Coordinator
Jul 20, 2010 at 6:29 PM

Qch, thanks for researching this.  I've passed this information along to the SSME team and will update this thread as I hear more.

Jul 20, 2010 at 8:12 PM
Hello krohling, Thank you very much for your time and quick responses.
Aug 4, 2010 at 11:10 AM

I've the same problem as Qch. Player works fine with not DRM protected media files, but crashes when it comes to DRM. I've managed workaround. When playing reaches end position then there is an event Media Ended. Then I disable PlayElement using:

this.PlayElement.IsEnabled = false;

My player does not provide option for reloading media source and playing it once again. Only one play per instance is supported.

 

There shoud be a flag or somethind to signal if user has only play once license or storable for viewing multiple times.

 

Qch for your solution:

Have you tried clearing playlist and loading media source once again and setting start position when user stopped? Looks ridiculous, but may by a workaround.

Feb 3, 2011 at 5:55 PM

Hello,

 

This strange behavior still exists. When SSME Shutdown's there is nothing you can do to make it play videos again (only browser restart, at least I found no other solution :( ). It just keeps raising 6027 error which I can't find in the internet.

Feb 8, 2011 at 6:13 PM

Hello,

Sorry, my bad. I’ve checked again, and piteerus was right, and not only right :) the main idea is to reset the source of the SSME/ME before Play() method is used. In case of SMF, one can simply override the Play() method, reset the CurrentPlaylistItem in it and set it to some local variable which contains current playlist item. E.g.

 

public override void Play()

       {

               // Try to reloaded media element.

               this.CurrentPlaylistItem = null;

               this.CurrentPlaylistItem = this._item;

 

           base.Play();

       }

 

This need to be done for DRM encrypted content only. this._item variable can be set earlier in a code.

Feb 8, 2011 at 6:51 PM

there is another issue raised in relation to this, when stop() is called on a mediaElement that is playing back protected content the mediaElement enters a closed state. This can be observed using pure silverlight with just a mediaElement, this seems to be an issue with silverlight 4. The mediaelement documentation does not reflect this behaviour and states that the element should enter a stopped state.

Apr 19, 2011 at 10:18 PM

Hi Guys,

               I am facing an Unhandled Exception popup when I run my Silverlight application. The Unhandled Exception says "Unhandled Error in Silverlight Application Could not load file or assembly 'Microsoft.SilverlightMediaFramewrok.Core, Version=2.2011.410.1, Culture=neutral, PublicKeyToken=' or one of its dependencies. The system cannot find the file specified. at SilverlightApplication1.MainPage..ctor()"

Kindly help me out with this guys since I've been struggling for weeks to figure out why this is happening. I did replace my old Microsoft.SilverlightMediaFramewrok.Core.dll file with the latest one and I am not sure if that caused the problem.

And my Player never comes up as well.

 

Thanks,

Vikas

Coordinator
Apr 19, 2011 at 10:42 PM

Vikas, try a clean and rebuild in Visual Studio to see if it fixes the problem. If that doesn't work, try removing the references to all SMF assemblies and re-add them.

Tim

Apr 22, 2011 at 9:53 PM

Thanks Tim,

                     I did try them all. I added them again but to no avail. This is the structure of my project solution.

2 projects in my solution

1. Silverlight Project which has the Player code

2. ASP.Net project in which I have a service to fetch files from a directory and return them to my player as media source (Video file URL, Thumbnail URL etc.).

 

Thanks,

Vikas