/// <summary> /// Plays the audio/video. /// </summary> public void Play() { if (mediaEngineEx != null) { if (mediaEngineEx.HasVideo() && isVideoStopped) { isVideoStopped = false; } if (IsEndOfStream) { PlaybackPosition = 0; IsPlaying = true; } else { if (textureView == null) { int width = 0; int height = 0; mediaEngineEx.GetNativeVideoSize(out width, out height); OutputVideoTexture = new SharpDX.Direct3D11.Texture2D( d3dDevice, new SharpDX.Direct3D11.Texture2DDescription() { ArraySize = 1, Width = width, Height = height, Usage = SharpDX.Direct3D11.ResourceUsage.Default, Format = SharpDX.DXGI.Format.B8G8R8A8_UNorm, CpuAccessFlags = SharpDX.Direct3D11.CpuAccessFlags.None, BindFlags = SharpDX.Direct3D11.BindFlags.RenderTarget | SharpDX.Direct3D11.BindFlags.ShaderResource, OptionFlags = SharpDX.Direct3D11.ResourceOptionFlags.None, SampleDescription = new SharpDX.DXGI.SampleDescription(1, 0), MipLevels = 1, }); textureView = new ShaderResourceView(d3dDevice, OutputVideoTexture); } mediaEngineEx.Play(); } IsEndOfStream = false; } }
/// <summary> /// Plays the audio/video. /// </summary> public void Play() { if (mediaEngineEx != null) { if (mediaEngineEx.HasVideo() && isVideoStopped) { isVideoStopped = false; } if (isEndOfStream) { PlaybackPosition = 0; IsPlaying = true; } else { mediaEngineEx.Play(); } isEndOfStream = false; } }