Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Resume last playback position" doesn't work any more #4997

Closed
2V3EvG4LMJFdRe opened this issue Jun 16, 2024 · 4 comments
Closed

"Resume last playback position" doesn't work any more #4997

2V3EvG4LMJFdRe opened this issue Jun 16, 2024 · 4 comments

Comments

@2V3EvG4LMJFdRe
Copy link

System and IINA version:

  • macOS 10.13.6
  • IINA 1.3.4 Build 140
  • Does not have the bug on my end: IINA 1.3.1 Build 133

Expected behavior:

After checking "Resume last playback position": I play a video, I get to a certain part during playback, I close IINA. When I open IINA with the video again, I resume from that part.

Actual behavior:

When I open IINA with the video again, start from 00:00:00 on all video files.

How often does this happen?

Always.

For reference, I have confirmed playback creates the corresponding file on .config/iina/watch_later even after I remove this folder and start from scratch.

@low-batt
Copy link
Contributor

Did not reproduce for me.

Based on you mentioning you have confirmed the watch later file is being created I'm expecting you already know a lot about mpv's Watch Later system, so please forgive me if I'm explaining details you already know.

This part of the report caught my attention:

For reference, I have confirmed playback creates the corresponding file on .config/iina/watch_later even after I remove this folder and start from scratch.

That is not where IINA stores its files by default. Normally the files are found in ~/Library/Application\ Support/com.colliderli.iina/watch_later. In IINA's settings on the Advanced tab, have you added configuration in the Additional mpv options setting? Or checked the Use config directory?

This is me checking the contents of the watch later file in the test I ran:

low-batt@gag ~$ md5 -qs '/Users/low-batt/Movies/issue-4997.mp4' | xargs -I % cat ~/Library/Application\ Support/com.colliderli.iina/watch_later/%
start=15.933333
pause=yes
volume=72.957512
low-batt@gag ~$ 

Recently I found the watch later feature was malfunctioning. I've been planning on reproducing that again and confirming what I thought was happening. Just haven't had time. I had been testing watch later using both IINA and the mpv player. That caused a watch later file to be created in ~/.config/mpv/watch_later by mpv. I'm pretty sure that when I ran IINA libmpv read that file and not the watch later file stored in IINA's directory. I still need to confirm that, but if you also run mpv, watch out for something like that.

As discussed in mpv's documentation for save-position-on-quit, information is only saved if playback is stopped by quitting. This is true for IINA as well. From the report it sounds like you are quitting IINA while playing and yet playback starts from the begining. That should not occur.

There were problems with IINA sometimes not writing the watch later file. This was due to a race condition when IINA was exiting. That has been fixed. You should now see something like the following in IINA's log file when it terminates:

17:19:39.329 [iina][d] App should terminate
17:19:39.330 [iina][d] Disabling all menus
17:19:39.330 [iina][d] Disabling remote commands
17:19:39.332 [iina][d] Closing all windows
17:19:39.332 [player0][d] Write watch later config
17:19:39.336 [player0][d] Stopping playback
17:19:39.341 [iina][d] Waiting for players to stop and shutdown
17:19:39.370 [player0][d] Playback has stopped
17:19:39.371 [player0][d] Shutting down
17:19:39.378 [player0][d] Player has shutdown
17:19:39.378 [iina][d] All players have shutdown
17:19:39.378 [iina][d] Proceeding with application termination
17:19:39.378 [iina][d] App will terminate

If you are seeing something different we'd want to look into why IINA in your environment does not behave the same way during termination.

@2V3EvG4LMJFdRe
Copy link
Author

You're right, I should have shared my mpv.conf as well. I completely forgot about lines affecting the watch_later configuration including its path, which I had changed at some point so that IINA would share these with mpv. From this, I have found the culprit: having watch-later-options-clr on mpv.conf always writes a 1 line watch_later config file which simply reads the path of the file therefore missing the start= line:

# /Users/blablabla/movie.mkv

It's an obscure option, I had added it myself to solve this #4357 there now seems to be no way to save playback position without also saving all the other data (saturation, gamma, etc) which I often change on a whim depending on which monitor I'm using on a given day.

Full mpv.conf for reference:

# Playback
hwdec="auto-safe"
profile="gpu-hq"
video-sync="display-resample"
audio-file-auto="all"
demuxer-mkv-subtitle-preroll="yes"
audio-channels="stereo"
deband="no"
volume-max="300"
af=lavfi=[loudnorm=I=-16:TP=-3:LRA=4]
watch-later-options-clr

# Other
use-filedir-conf
watch-later-directory="~/.config/iina/watch_later"
write-filename-in-watch-later-config
screenshot-jpeg-quality="100"
screenshot-template="%F %P"
title="${filename/no-ext}"

@low-batt
Copy link
Contributor

I really appreciate the update. I was worried about what was causing this.

Have you tried setting watch-later-options to start after watch-later-options-clr?

I've been worried about how IINA interacts with user configured mpv options in both IINA's advanced settings and in external mpv config files. I would expect that IINA would as much as possible allow the user to set mpv configuration and avoid overwriting options the user has set. One problem with doing so is that I don't see a way for IINA to know that the user has set something in a mpv config file.

@2V3EvG4LMJFdRe
Copy link
Author

Awesome! That works indeed. I will close the issue on that ground.

Personally I am ok with the way IINA interacts with these advanced config files. The way the option is positioned within the app makes it clear you are past the territory of common support and are at some point going to face some kind of contradiction within the two frameworks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants