Commit f35eec53 authored by Martin Finkel's avatar Martin Finkel

Fix #116: Add user setting to choose whether to resume position or restart playback

parent fe64caa2
......@@ -356,8 +356,11 @@ namespace VLC.Services.RunTime
CurrentMedia.addOption(!Locator.SettingsVM.HardwareAccelerationEnabled ? ":avcodec-hw=none" : ":avcodec-hw=d3d11va");
if (DeviceHelper.GetDeviceType() == DeviceTypeEnum.Phone)
CurrentMedia.addOption(!Locator.SettingsVM.HardwareAccelerationEnabled ? ":avcodec-threads=0" : ":avcodec-threads=1");
var pos = await FetchPreviousPosition(media);
CurrentMedia.addOption($":start-time={pos}");
if (Locator.SettingsVM.ResumePreviousPosition)
{
var pos = await FetchPreviousPosition(media);
CurrentMedia.addOption($":start-time={pos}");
}
if (_mediaPlayer == null)
{
......
......@@ -287,6 +287,7 @@ namespace VLC.Utils
public static string NotificationWhenSongStarts => _resourcesLoader.GetString(nameof(NotificationWhenSongStarts));
public static string VideoPlaybackInBackground => _resourcesLoader.GetString(nameof(VideoPlaybackInBackground));
public static string CompactOverlayPiP => _resourcesLoader.GetString(nameof(CompactOverlayPiP));
public static string ResumeOrRestartPlayback => _resourcesLoader.GetString(nameof(ResumeOrRestartPlayback));
public static string EvenIfBackground => _resourcesLoader.GetString(nameof(EvenIfBackground));
public static string EvenIfNotBackground => _resourcesLoader.GetString(nameof(EvenIfNotBackground));
public static string NeedRestart => _resourcesLoader.GetString(nameof(NeedRestart));
......
......@@ -623,6 +623,12 @@ namespace VLC.ViewModels.Settings
public ChangeSettingsViewCommand ChangeSettingsViewCommand { get; } = new ChangeSettingsViewCommand();
public bool ResumePreviousPosition
{
get => ApplicationSettingsHelper.ReadSettingsValue(nameof(ResumePreviousPosition)) as bool? ?? true;
set => ApplicationSettingsHelper.SaveSettingsValue(nameof(ResumePreviousPosition), value);
}
public static void SwitchLanguage(Languages language)
{
var currentCulture = "en-US";
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -1161,6 +1161,10 @@
<source>Czech</source>
<target state="new">Czech</target>
</trans-unit>
<trans-unit id="ResumeOrRestartPlayback" translate="yes" xml:space="preserve">
<source>Resume or restart playback</source>
<target state="new">Resume or restart playback</target>
</trans-unit>
</group>
</body>
</file>
......
......@@ -811,6 +811,9 @@
<data name="CompactOverlayPiP" xml:space="preserve">
<value>use windows 10 pip</value>
</data>
<data name="ResumeOrRestartPlayback" xml:space="preserve">
<value>Resume or restart playback</value>
</data>
<data name="TvUnsafeArea" xml:space="preserve">
<value>TV unsafe area</value>
</data>
......
......@@ -265,6 +265,12 @@
Header="{Binding Source={StaticResource Strings}, Path=CompactOverlayPiP}"
IsOn="{Binding CompactOverlayPiP, Mode=TwoWay}" />
<ToggleSwitch Name="ResumeOrRestartPlayback"
Header="{Binding Source={StaticResource Strings}, Path=ResumeOrRestartPlayback}"
OffContent="Restart"
OnContent="Resume"
IsOn="{Binding ResumePreviousPosition, Mode=TwoWay}"/>
<toolkitControls:HeaderedTextBlock Margin="{StaticResource FrameMarginTop}"
Header="{Binding Source={StaticResource Strings}, Path=SubtitlesEncoding}"
Text="{Binding Source={StaticResource Strings}, Path=NeedRestart}"
......
  • If I might suggest, would this better solved using a modal that asks the user which they want to do when the retrieved pos for a file is not 0? I ask only because this seems like the type of situation where user preference could change file-to-file rather than on a consistent ongoing basis.

    Edited by Kyle Tirak
  • Popping a dialog each time the user wants to play something does not seem very UX friendly, especially for people who always go for the same option.

    How about a middle ground? Do like the classic desktop app, provide "ask", "resume" and "restart" options?

  • Perhaps, though the dialog would only ever need to be popped when a file has been started and not finished (i.e. pos is not 0 or whatever value the beginning corresponds to).

    Another option would be to leave it as is and include Play and Resume in a context menu for files (Resume grayed out if not needed). I think Kodi does something similar? Though I think they also mark files that were started and not finished.

Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment