void MediaElement_LinearClipChanged(object sender, ClipEventArgs e) { if (MediaElement.CurrentLinearClipContext != null) { CurrentStateChanged.IfNotNull(i => i(this, MediaPluginState.ClipPlaying)); linearAdContext = new LinearAdContext(e.Context, MediaElement); AdStateChanged.IfNotNull(i => i(this, linearAdContext)); } else { AdStateChanged.IfNotNull(i => i(this, linearAdContext)); linearAdContext = null; CurrentStateChanged.IfNotNull(i => i(this, CurrentState)); } }
/// <summary> /// Unloads a plug-in for adaptive media. /// </summary> public void Unload() { try { IsLoaded = false; #if !WINDOWS_PHONE _chunkDownloadManager.Dispose(); _scheduledAds.Clear(); linearAdContext = null; #endif UnloadManifest(); DestroySmoothStreamingMediaElement(); PluginUnloaded.IfNotNull(i => i(this)); SendLogEntry(KnownLogEntryTypes.SmoothStreamingMediaPluginUnloaded, message: SmoothStreamingResources.SmoothStreamingMediaPluginUnloadedLogMessage); } catch (Exception err) { string message = string.Format(SmoothStreamingResources.SmoothStreamingMediaPluginUnloadFailedLogMessage, err.Message); SendLogEntry(KnownLogEntryTypes.SmoothStreamingMediaPluginErrorOccurred, severity: LogLevel.Error, message: message); PluginUnloadFailed.IfNotNull(i => i(this, err)); } }