Hi,
Just trying to play a video in my UWP app. I get the following error when I call VideoPlayer.GetTexture(). Works fine in Windows Desktop app.
"SharpDX.SharpDXException: 'HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.
’ "
Share your playback code,
For UWP I am planning to try a page flip to use the system video player while MG loads in the background, unsure if this will work but, will try it very soon!
Hi, thanks for the answer!
I’m using a .wmv video as the source. Everything works fine as a Windows Desktop app.
Notes:
- SpriteBatchHelper is a custom helper class
- videoPlayer is declared as a class private field
Here is the code
protected override void OnDraw(GameTime gameTime)
{
base.OnDraw(gameTime);
if (videoPlayer.State == MediaState.Playing)
{
texture = videoPlayer.GetTexture();
if (texture != null)
{
SpriteBatchHelper.Begin(SpriteBatchCamera.UI, SamplerState.LinearClamp);
TinyGame.Instance.SpriteBatch.Draw(texture, new Rectangle(0, 0, 320, 180), Color.White);
SpriteBatchHelper.End();
}
}
}
Thanks
I think I used similar code from an old XNA book, will try it again on desktop, then this would be a bug once that is confirmed…
In addition, importing an MP4 video does not work in windows desktop version. An exception is raised telling that a null texture was returned. The video is correctly encoded in h.264.
My game is going to be available in various platforms. This is a potential problem for me as I can see the video features are very buggy right now. Anyway, I just use videos to present the studio and the publisher, so I think I will be ending using static images instead.
1 Like