private void SetMediaStreamInfo(StreamType streamType, MediaFormat mediaFormat) { if (mediaFormat == null) { Log.Error(PlayerLog.Tag, "invalid media format"); return; } IntPtr ptr = IntPtr.Zero; try { ptr = mediaFormat.AsNativeHandle(); NativePlayer.SetMediaStreamInfo(_player.Handle, (int)streamType, ptr). ThrowIfFailed("Failed to set the media stream info"); } finally { MediaFormat.ReleaseNativeHandle(ptr); } }