Skip to content

Commit

Permalink
Add FromUriEXT method to Video (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiddkaffeine authored Apr 3, 2023
1 parent a0c0eb1 commit 575439a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/Media/Xiph/Video.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#region Using Statements
using System;
using System.IO;

using Microsoft.Xna.Framework.Graphics;
#endregion
Expand Down Expand Up @@ -164,6 +165,31 @@ VideoSoundtrackType soundtrackType
#endregion

#region Public Extensions

public static Video FromUriEXT(Uri uri, GraphicsDevice graphicsDevice)
{
string path;
if (uri.IsAbsoluteUri)
{
// If it's absolute, be sure we can actually get it...
if (!uri.IsFile)
{
throw new InvalidOperationException(
"Only local file URIs are supported for now"
);
}
path = uri.LocalPath;
}
else
{
path = Path.Combine(
TitleLocation.Path,
uri.ToString()
);
}

return new Video(path, graphicsDevice);
}

public void SetAudioTrackEXT(int track)
{
Expand Down

0 comments on commit 575439a

Please sign in to comment.