-
Notifications
You must be signed in to change notification settings - Fork 8
/
VideoHelper.cs
56 lines (48 loc) · 1.73 KB
/
VideoHelper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System.IO;
using MonoGame.Extended.Framework.Media;
namespace MonoGame.Extended.VideoPlayback;
/// <summary>
/// Video helper class.
/// </summary>
public static class VideoHelper
{
/// <summary>
/// Loads a video from file system using default decoding options.
/// </summary>
/// <param name="path">The path of the video file.</param>
/// <returns>Loaded video.</returns>
public static Video LoadFromFile(string path)
{
return LoadFromFile(path, DecodingOptions.Default);
}
/// <summary>
/// Loads a video from file system using specified decoding options.
/// </summary>
/// <param name="path">The path of the video file.</param>
/// <param name="decodingOptions">The decoding options to use.</param>
/// <returns>Loaded video.</returns>
public static Video LoadFromFile(string path, DecodingOptions decodingOptions)
{
var fullPath = Path.GetFullPath(path);
return LoadFromUrl(fullPath, decodingOptions);
}
/// <summary>
/// Loads a video from a URL using default decoding options.
/// </summary>
/// <param name="url">The URL of the video source.</param>
/// <returns>Loaded video.</returns>
public static Video LoadFromUrl(string url)
{
return LoadFromUrl(url, DecodingOptions.Default);
}
/// <summary>
/// Loads a video from a URL using specified decoding options.
/// </summary>
/// <param name="url">The URL of the video source.</param>
/// <param name="decodingOptions">The decoding options to use.</param>
/// <returns>Loaded video.</returns>
public static Video LoadFromUrl(string url, DecodingOptions decodingOptions)
{
return new Video(url, decodingOptions);
}
}