XBMC.PlayMedia() built-in > video playback resuming even when configured not to
"Settings > Video > Playback > Resume from where last stopped" - Set to No, doesn't seem to work as intended. Yes and Ask works fine, but No will still resume a video from where it was stopped/resume point was created.
Updated by dandar3 about 3 years ago
- Subject changed from Video file resume playback no setting doesn't work. to Video "Resume from where last stopped" = NO setting doesn't behave as expected
Updated by dandar3 almost 3 years ago
- File Builtins.cpp.variantA.patch Builtins.cpp.variantA.patch added
- File Builtins.cpp.variantB.patch Builtins.cpp.variantB.patch added
- Subject changed from Video "Resume from where last stopped" = NO setting doesn't behave as expected to XBMC.PlayMedia() built-in > video playback resuming even when configured not to
Finally I think we identified the problem in
askToResume is set to
true by default (when not overridden through additional parameters), that makes later logic to call
CGUIWindowVideoBase::OnResumeShowMenu() which sets the item resume flag to resume.
Attaching a fix to default
askToResume to the correct default value based on whether the system setting
videoplayer.resumeautomatically is set to RESUME_ASK as it should really.
Unfortunatelly the call to CGUIWindowVideoBase::OnResumeShowMenu() was also making it resume correctly when the system was configured to resume automatically(RESUME_YES), so I had to introduce a second variable to make that case work as expected.
That looked a bit harder to understand so I've also attached a second version that uses a single int variable instead of the two booleans. Please feel free to choose or change as you see fit.