CastagnaIT / plugin.video.netflix

InputStream based Netflix plugin for Kodi
MIT License
1.91k stars 259 forks source link

Bookmark position is wrong after seeking to end #911

Closed wagnerch closed 3 years ago

wagnerch commented 3 years ago

Bug report

Your Environment

Used Operating system:

Describe the bug

I typically seek to end (usually up arrow, +10 minutes) to stop the videos, this was working fine up until recently. What seems to happen now is the video shows as partially watched (about 10 minutes). My guess is this is related to commit a24c548ecee761790096ce8593af764b22323acd, as what Kodi thinks is the bookmark position is the amount that I seeked. This also happens if I do right arrow 3 or 4 times (it will be around 2-3 minutes as the bookmark position).

This seems to be cosmetic/caching on the addon side, because on Netflix the bookmark position shows around ~39 minutes which is around where I used the seek.

Expected behavior

Bookmark position on Netflix & Kodi should be runtime of video.

Actual behavior

Bookmark position on Kodi is roughly the amount of time seeked forward. On Netflix it is the time in the video where I seeked forward (probably the last keepAlive?).

Steps to reproduce the behavior

  1. Start video
  2. Seek to a few minutes before end
  3. Let keepAlive event go out
  4. Seek to end

Possible fix

Debug log

The debug log can be found from this link: kodi.log

Additional context or screenshots (if appropriate)

screenshot000

Installation

Other information

I have also occasionally received this back trace, but I haven't been able to reproduce it yet with debugging:

2020-10-25 17:54:54.167 T:2666516688   ERROR: [plugin.video.netflix (0)] Traceback (most recent call last):
                                              File "/home/kodi/.kodi/addons/plugin.video.netflix/resources/lib/services/playback/action_controller.py", line 90, in onNotification
                                                self._on_playback_seek(json.loads(data)['player']['seekoffset'])
                                              File "/home/kodi/.kodi/addons/plugin.video.netflix/resources/lib/services/playback/action_controller.py", line 138, in _on_playback_seek
                                                player_state = self._get_player_state(time_override=time_override)
                                              File "/home/kodi/.kodi/addons/plugin.video.netflix/resources/lib/services/playback/action_controller.py", line 199, in _get_player_state
                                                player_state['percentage'] = player_state['percentage'] / player_state['elapsed_seconds'] * elapsed_seconds
                                            ZeroDivisionError: float division by zero

This I suspect is related to the same commit mentioned earlier.

Screenshots

wagnerch commented 3 years ago

Didn't mean to close the issue. Github, stupid keyboard shortcuts! :) @CastagnaIT can you reopen?

wagnerch commented 3 years ago

Added some logging to capture the "data" sent in action_controller.py's onNotification for OnSeek. Currently timeoverride is using "player/seekoffset", should maybe be the "player/time" as the seek offset appears to be the amount that I seeked by?

{
    "item": {
        "episode": 7,
        "season": 1,
        "showtitle": "Locke & Key",
        "title": "Dissection",
        "type": "episode"
    },
    "player": {
        "playerid": 1,
        "seekoffset": {
            "hours": 0,
            "milliseconds": 0,
            "minutes": 10,
            "seconds": 0
        },
        "speed": 1,
        "time": {
            "hours": 0,
            "milliseconds": 585,
            "minutes": 20,
            "seconds": 1
        }
    }
}

{
    "item": {
        "episode": 7,
        "season": 1,
        "showtitle": "Locke & Key",
        "title": "Dissection",
        "type": "episode"
    },
    "player": {
        "playerid": 1,
        "seekoffset": {
            "hours": 0,
            "milliseconds": 0,
            "minutes": 10,
            "seconds": 0
        },
        "speed": 1,
        "time": {
            "hours": 0,
            "milliseconds": 528,
            "minutes": 30,
            "seconds": 2
        }
    }
}
CastagnaIT commented 3 years ago

hi that's weird when i did the tests I seemed to mark the exact position i must have taken the wrong log I will have to check if there are differences between Kodi 19 and 18 thanks for the details i will make other tests

you made the record of the longest log :)

wagnerch commented 3 years ago

I might have got distracted and watched the episode. :)

CastagnaIT commented 3 years ago

I have check and you are right I mixed the files of the local branch... at the beginning i had done the addition of the offset then i changed way..

CastagnaIT commented 3 years ago

add to daily build

wagnerch commented 3 years ago

That's the change I did as well and it's been working on Kodi 18.9 with no problems.

fernandog commented 3 years ago

@wagnerch I don't know if is related but when I seek forward 10s (in the middle of the video), it goes back to 0:00 and sometimes it stop playing (no image but player still on screen). The only way to make it work is fast forward and disable the FF. If I FF and hit play, it also go back to 0:00. Other times when FF +10s it goes forward then goes back to current position.

I applied the patch you mentioned and issue persist. I also downgrade to the last 3 versions with no luck.

Do you have this issue?

wagnerch commented 3 years ago

@fernandog I only use "seek steps" when seeking, it sounds like you are fast-forwarding? Seek steps I usually just hit left arrow or right arrow and it will seek +10s, +1m, +3m. Up arrow/down arrow will seek +10m.

fernandog commented 3 years ago

@wagnerch no, issue happens when I do seek steps (+10 or -10s)

Small video: https://we.tl/t-oGVH00HKde

wagnerch commented 3 years ago

@fernandog If that is the Netflix addon then you probably want to open an issue with a debug log. If that is some other addon or a live stream, then a live stream would explain the behavior you are seeing (I tend to see that behavior on Live PVR & m3u8 live streams). I have never seen that in the Netflix addon.

https://github.com/CastagnaIT/plugin.video.netflix#something-doesnt-work

This might be an input stream adaptive issue, because afaik Netflix addon doesn't actually manage seeking through the stream, it just handles the coordination with Netflix site to get the manifest, passes that off to Inputstream Adaptive and then between Widevine, Inputstream Adaptive, and probably Kodi the magic happens with the stream.

My issue is with bookmark positions within Kodi after seeking. Netflix addon passively listens to events from Kodi about seeks, and then tracks the player progress and updates bookmark positions within Kodi & Netflix (if you have the latter enabled like I do).

fernandog commented 3 years ago

@wagnerch it's the NF addon from this repo. I will an issue soon. Thanks!

CastagnaIT commented 3 years ago

@fernandog I saw the video and you are talking about the Kodi player this add-on has no control over the playback

so your problem must be reported on Kodi, then not here, i can do nothing here

if you are using some kind of Kodi OS like CoreElec you have to report to they repository/forum if you are using non-original skins before report you have to switch/test on the original Kodi skin