Conversation
There was a problem hiding this comment.
We need someone who can help us with code reviews :D Thanks for implementing this. I have no time to review the code now, but I quickly tested your changes.
I think we might need a setting to turn resume on and off / make it clearer that this is done by turning the watch history off. Maybe some additional words are needed in the summary of the watch history setting. Btw. can you please correct "History & Cache" to "Watch history"?
What do you think of showing the player interface instead of the toast? When the users sees that the current position is not at the beginning, they should understand that the last position has been restored. At the same time, they are able to hit the double back icon, to go to 0:00.
How do we want to handle exits which are right before the end? Many YouTube videos have these cards/ end-screens where you can select a recommended video to play next. In NewPipe these links are not shown and these end-cards have no value. I can only speak about my workflow, but I guess many other people hit next as soon this last image appears, too.
Yes, I will implement it also
ok 👌
This feature needs extractor changes. As far as I understand, it needs some time for implementation. I'll think about it. |
Sorry, you got me wrong :) One possible problem could be the saving of the position when you exit the video right before the end (~10 seconds). |
|
Ok, good note. Maybe, ignore saved position if left less then 10 seconds |
|
I think, it is done, aren't?) |
Almost :) When upgrading from 0.14.2 or current dev, I get following crashes at app start: Exception
Crash log
Exception
Crash log
|
|
Hm |
|
Hi @nv95. Thank you for you work. I just want to quickly mention the playback position saving and loading is already available, so there is no need to update the database and create another migration. This is done on a separate StreamState table, so the stream metadata and user-generated data for streams can be kept and updated separately. |
|
It is unused now, and I don't understand how to use StreamState. Besides my solution is simple and ready to use now |
|
@karyogamy welcome back! It's good to hear from you. Do you have time to review the code further? @karyogamy @theScrabi It might be good to have a model of our db in the wiki, so devs can work with it easier. What do you think? |
|
Ok? |
Sounds good. |
|
Documented the database. See here: The files need to be enroled in a wiki/documentation though. |
|
Thanks for fixing that. One minor thing is left:
I think we should do the same with pop-up and background player. |
I think it must works in any player |
|
I tested and it didn't work for some reason. This is what I did:
|
TobiGr
left a comment
There was a problem hiding this comment.
There are some problems with the popup player:
- start a video in popup mode by clicking on a timestep-link in a video description or comment
- Notice the video repeating the first miliseconds again and again until some more of the video stream is buffered.
- Let the video play for some seconds
- Pause the video. Notice the current playback position is reset back to the point from where we started in 1.
In some cases this problem is even bigger.
- start a video in popup mode by clicking on a timestep-link in a video description or comment
- start another video in popup mode by clicking on a timestep-link in a video description or comment
- let the first video finish or skip it (to skip it, click on the popup notification and then press the control to get to the next video
- You'll be in an endless loop of the first frames. The only way the interrupt the loop is pressing the pause button. after pressing play again, the video is played properly.
- open a video and play it with the main player
- switch to background and remember the current playback position
- let the stream finish and wait until the next element in the queue starts to play
- open the video detail page of the stream which just finished. Notice the time for playback resume is the same at which we switched to background.
Unfortunately, this is not resolved yet.
We might need to discuss the correct error handling. First of all, we should only log when we have a debug build. Apart from that, we can create a bug report and display it to the user. @theScrabi Can you please take a look at the lines below and tell us how you would handle the errors?
| } | ||
| }, | ||
| error -> { | ||
| Log.e(TAG, "Player resume failure: ", error); |
There was a problem hiding this comment.
| Log.e(TAG, "Player resume failure: ", error); | |
| if (DEBUG) Log.e(TAG, "Player resume failure: ", error); |
| changeState(playWhenReady ? STATE_PLAYING : STATE_PAUSED); | ||
| }, | ||
| error -> { | ||
| Log.e(TAG, "Player resume failure: ", error); |
There was a problem hiding this comment.
| Log.e(TAG, "Player resume failure: ", error); | |
| if (DEBUG) Log.e(TAG, "Player resume failure: ", error); |
| protected void savePlaybackState(final StreamInfo info, final long progress) { | ||
| private void savePlaybackState(final StreamInfo info, final long progress) { | ||
| if (info == null) return; | ||
| Log.d(TAG, "savePlaybackState() called"); |
There was a problem hiding this comment.
| Log.d(TAG, "savePlaybackState() called"); | |
| if (DEBUG) Log.d(TAG, "savePlaybackState() called"); |
| private void savePlaybackState() { | ||
| private void resetPlaybackState(final StreamInfo info) { | ||
| if (info == null) return; | ||
| Log.d(TAG, "resetPlaybackState() called"); |
There was a problem hiding this comment.
| Log.d(TAG, "resetPlaybackState() called"); | |
| if (DEBUG) Log.d(TAG, "resetPlaybackState() called"); |
| .onErrorComplete() | ||
| .subscribe( | ||
| ignored -> {/* successful */}, | ||
| error -> Log.e(TAG, "resetPlaybackState() failure: ", error) |
|
I have some troubles with understanding, where and when is rationally to save playback state. Also I think, that it is undesirable to call |
this bug is not related to the saving playback state |
|
@yausername I found a trouble with |
Sure. We all want to have the best result in the end. If this takes a bit longer - no problem :)
That's good to know. I didn't test the latest dev and compared the bugs of this PR with the dev branch. |
|
@yausername your patch is not compatible with this pr. I propose to merge #2207 first, then I will complete this. |
|
Oh 😅 |
|
@nv95 I'll do one last round of testing. Is there anything you intend to fix or change or have you completed your work on this? |
|
@TobiGr Sorry, I have not time just now, but I will do it whatever. Give me some time 👌 |
|
Any news about when this feature will be implemented? |

Store playing position in history table in database and resume it. Also show current position in VideoDetailFragment.
Closes #1970