Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3588f94

Browse files
author
Pierre Etchemaite
committed
use .webm video format on Linux
.mp4 format is not supported by VideoPlayer on Linux: https://docs.unity3d.com/Manual/VideoSources-FileCompatibility.html
1 parent dab37d4 commit 3588f94

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Assets/Scripts/Utility/AssetInjection/VideoReplacement.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ public static class VideoReplacement
2525
{
2626
static readonly string moviePath = Path.Combine(Application.streamingAssetsPath, "Movies");
2727

28+
// https://docs.unity3d.com/Manual/VideoSources-FileCompatibility.html
29+
#if !UNITY_STANDALONE_LINUX
30+
static readonly string videoExtension = ".mp4";
31+
#else
32+
static readonly string videoExtension = ".webm";
33+
#endif
34+
2835
/// <summary>
2936
/// Path to custom movies on disk.
3037
/// </summary>
@@ -49,7 +56,7 @@ public static bool TryImportMovie(string name, out VideoPlayerDrawer videoPlayer
4956
name = name.Substring(0, index);
5057

5158
// Seek from loose files
52-
string path = Path.Combine(moviePath, name + ".mp4");
59+
string path = Path.Combine(moviePath, name + videoExtension);
5360
if (File.Exists(path))
5461
{
5562
videoPlayerDrawer = new VideoPlayerDrawer(path);

0 commit comments

Comments
 (0)