public void PlayMedia(Media media) { try { if (media is Audio) { //Playing the sound this.engine.Play2D(media.getUrl(), false); } else if (media is Video) { //Taking note of the video before it was replaced if (this.currentVideo != null && this.lastPlayedVideoUrl != media.getUrl()) { this.videoToDispose = this.currentVideo; } if (this.loadedVideo != null) { this.currentVideo = this.loadedVideo; } else { //Playing the video this.currentVideo = Microsoft.DirectX.AudioVideoPlayback.Video.FromFile(media.getUrl(), false); this.currentVideo.HideCursor(); } PlayFullScreenVideo(this.lastPlayedVideoUrl == media.getUrl()); this.lastPlayedVideoUrl = media.getUrl(); } } catch (Microsoft.DirectX.DirectXException) { //Video file not existing } }
public void LoadMedia(Media media) { try { if (media is Audio) { //Loads the sound this.engine.Play2D(media.getUrl(), false, true); } else if (media is Video) { //Loads the video this.loadedVideo = Microsoft.DirectX.AudioVideoPlayback.Video.FromFile(media.getUrl(), false); this.loadedVideo.HideCursor(); this.loadedVideo.Owner = this.loadForm.panVideo; this.loadedVideo.StopWhenReady(); } } catch (Microsoft.DirectX.DirectXException) { //Video file not existing } }