asciidisco / plugin.video.netflix

Inputstream based Netflix plugin for Kodi
MIT License
1.24k stars 226 forks source link

Fix playback when OMXPlayer is enabled #657

Closed dagwieers closed 5 years ago

dagwieers commented 5 years ago

A lot of users on Raspberry Pi are affected by a playback issue when OMXPlayer is enabled. On Raspberry Pi OMXPlayer improves playback of various streams, but it totally breaks Netflix playback.

This fixes reports on #237, #274, #286, #319, #656

Types of changes

All Submissions:

Changes to Core Features:

Screenshots (if appropriate):

[You can erase any parts of this template not applicable to your Pull Request.]

dagwieers commented 5 years ago

Hmm, it seemed to have worked once, but I cannot reproduce the fix. So I am not sure that this was what actually change behaviour (it could have been that it was still running when I switched OMXPlayer off).

dagwieers commented 5 years ago

The only reliable way to do this is disabling OMXPlayer on playback, and restore the configuration after playback. Disabling before playback is quite easy, but restoring the configuration is not that easy it seems.

dagwieers commented 5 years ago
def get_global_setting(setting):
    json_result = xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Settings.GetSettingValue", "params":{"setting":"%s"}, "id":1}' % setting)
    xbmc.log(msg='get_global_setting: ' + json_result, level=xbmc.LOGNOTICE)
    return json.loads(json_result)['result']['value']

def set_global_setting(setting, value):
    if value is True or value is False:
        json_result = xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Settings.SetSettingValue", "params":{"setting":"%s","value":%s}, "id":2}' % (setting, 'true' if value else 'false'))
    else:
        json_result = xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Settings.SetSettingValue", "params":{"setting":"%s","value":"%s"}, "id":2}' % (setting, value))
    xbmc.log(msg='set_global_setting: ' + json_result, level=xbmc.LOGNOTICE)
    return json.loads(json_result)

And then in before playback:

            omxplayer = get_global_setting('videoplayer.useomxplayer')
            set_global_setting('videoplayer.useomxplayer', False)
            self.play_video(
                video_id=params['video_id'],
                start_offset=params.get('start_offset', -1),
                infoLabels=params.get('infoLabels', {}))
            return True