diff --git a/OpenRA.Mods.Common/Scripting/Media.cs b/OpenRA.Mods.Common/Scripting/Media.cs index 21b12a5fb7..641b02e5e0 100644 --- a/OpenRA.Mods.Common/Scripting/Media.cs +++ b/OpenRA.Mods.Common/Scripting/Media.cs @@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Scripting try { - player.Load(videoFileName); + player.LoadAndPlay(videoFileName); } catch (FileNotFoundException) { @@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Scripting try { - player.Load(videoFileName); + player.LoadAndPlay(videoFileName); } catch (FileNotFoundException) { diff --git a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs index 1b05127dd0..66688dce47 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs @@ -550,7 +550,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (video != null) { player = panel.Get("PLAYER"); - player.Load(prefix + filename); + player.LoadAndPlay(prefix + filename); player.DrawOverlay = false; isVideoLoaded = true; diff --git a/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs index 80b88e5a43..88a1a083b4 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MissionBrowserLogic.cs @@ -370,7 +370,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic StopVideo(player); playingVideo = pv; - player.Load(video); + player.LoadAndPlay(video); if (player.Video == null) { diff --git a/OpenRA.Mods.Common/Widgets/VideoPlayerWidget.cs b/OpenRA.Mods.Common/Widgets/VideoPlayerWidget.cs index fb769bcb10..507caef7c2 100644 --- a/OpenRA.Mods.Common/Widgets/VideoPlayerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/VideoPlayerWidget.cs @@ -41,19 +41,27 @@ namespace OpenRA.Mods.Common.Widgets Action onComplete; - public void Load(string filename) + /// + /// Tries to load a video from the specified file and play it. Does nothing if the file name matches the already loaded video. + /// + /// Name of the file, including the extension. + public void LoadAndPlay(string filename) { if (filename == cachedVideoFileName) return; var stream = Game.ModData.DefaultFileSystem.Open(filename); var video = VideoLoader.GetVideo(stream, true, Game.ModData.VideoLoaders); - Open(video); + Play(video); cachedVideoFileName = filename; } - public void Open(IVideo video) + /// + /// Plays the given . + /// + /// An instance. + public void Play(IVideo video) { this.video = video;