Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
Can this UI behaviour be changed?
#1
Playing a video and pressing the return key on a remote will take you back to the window used to launch a video from IE the movie library. When clicking the same video as the video playing in the background, the video is restarted. Is there a setting to change this behaviour so that you are returned to the video playing in the background?
Reply
#2
Try Keymap Editor.
Reply
#3
(2023-04-08, 13:30)SEIKT Wrote: Playing a video and pressing the return key on a remote will take you back to the window used to launch a video from IE the movie library. When clicking the same video as the video playing in the background, the video is restarted. Is there a setting to change this behaviour so that you are returned to the video playing in the background?
There are control buttons you can access while a video is in this state; press Left, and the sidebar menu should slide out from the left. At the bottom are player controls, including a fullscreen button at the right. Press it, and you'll be back to your video. If you are at the Home screen, the fullscreen button will be on that screen in the upper left. It looks like a directional pad icon.

What if you don't like this behavior, which Kodi leaves video playing while it's obscured by, say, the Home window. That's not sensible to a lot of people, and often it's recommended that you edit the keymap to stop playback in this context:

https://forum.kodi.tv/showthread.php?tid...pid2672441

I used to do that, but I was annoyed that if I did it within a couple of minutes of starting a movie, Kodi wouldn't record the resume point, so restarting the video would commence from the beginning. This is not just some hypothetical usage, because sometimes you want to see the actors, and the only way I know to do that is to view the "Information" screen for the movie, which AFAIK requires backing out until you can invoke the context menu on the movie item. There's got to be another way, but I haven't found it, and even if there is, you might not have a spare button on your remote for it.

So instead of letting video continue to play while it's obscured in the background, I thought it would be nice to pause video when pressing the Back button, and then when Back is pressed again from the Home screen, resume playback. So I wrote this function in AutoHotkey to do it:

Code:
KodiBack()
{
    ; This function pauses video when the Back button is pressed instead of letting it
    ; play when obscured by cover art and other Home screen UI. It unconditionally resumes
    ; playback when re-entering the "Fullscreen video" window; it doesn't try to maintain
    ; state and remember whether the previous Back paused the video.
    ;
    ; Unfortunately, Pause is the same as PlayPause, so it's more complicated than it needs to be.
    ; For example, if you had paused the video, pressed Back to go Home, then re-entered the
    ; video by pressing the directional pad navigation icon in the upper left of the screen,
    ; the video would still be paused, which is fine. The problem is that pressing Back to go
    ; Home again would cause the video to resume playing, even though I sent it the "pause" command.
    ; So, you have to check if it's paused or not, because "pause" isn't a discrete command
    ; despite its name.
    ;
    ; Note that it only resumes playback from the Home window, so backing out of the OSD and
    ; other overlays doesn't trigger it.
    ;
    ; KodiIsFullScreenVideo and KodiIsHomeWindow use GUI.GetProperties("currentwindow").
    ; KodiIsPlayerPaused defaults to videoplayer and uses Player.GetProperties("speed"); 0 is paused.

    if (KodiIsFullScreenVideo())
    {
        if (!KodiIsPlayerPaused())
            KodiExecuteAction("pause")
        KodiExecuteAction("back")
    }
    else if (KodiIsHomeWindow())
    {
        KodiExecuteAction("back")
        if (KodiIsFullScreenVideo() && KodiIsPlayerPaused())
            KodiExecuteAction("play")
    }
    else
        KodiExecuteAction("back")
}

This is nice, but what if you started the video from deeper inside the Kodi UI than the home screen? I typically don't want to have to back out all the way to the Home screen so that the next Back command resumes it, so I also take over the Play function:

Code:
KodiPlay()
{
    if (!KodiIsFullScreenVideo() && KodiIsPlayerPaused())
        KodiExecuteAction("fullscreen")
    KodiExecuteAction("playpause")
}

Now if I've started a show from a TV season view, Back pauses the video and returns me to the season, and I can dismiss the season view and resume playback by pressing Play on my remote. This incorporates what I suggested you do in the first paragraph to go directly back to your video, and without executing the "fullscreen" command, Kodi would resume playback while leaving the video obscured by the UI.

To me, this all works a lot more naturally than the standard behavior. However, my KodiPlay function does depend on the remote having a dedicated Play button. Some of the stupider minimal remotes like CCwGTV and Onn 4K box actually did away with all the transport buttons, including Play, making the Select button do double duty for it. So with those remotes, you'd have to use the Kodi transport controls mentioned in the first paragraph, or back out all the way to the Home screen, where KodiBack would dismiss it and resume playback.

If this sounds useful to anyone, see if you can write it in Python so it will be available from keymaps using the RunScript() command.

P.S. I don't understand why the second code block is double-spaced. I'm unable to fix it using the forum editor.
Reply
#4
(2023-04-24, 05:10)crawfish Wrote: I used to do that, but I was annoyed that if I did it within a couple of minutes of starting a movie, Kodi wouldn't record the resume point, so restarting the video would commence from the beginning. This is not just some hypothetical usage, because sometimes you want to see the actors, and the only way I know to do that is to view the "Information" screen for the movie, which AFAIK requires backing out until you can invoke the context menu on the movie item. There's got to be another way, but I haven't found it, and even if there is, you might not have a spare button on your remote for it.

1.   Consider tweaking
xml:
<ignoresecondsatstart>180</ignoresecondsatstart>
in advancedsettings.xml to control when resume point is saved.

2.  Try /playlist/info from full screen video.

scott s.
.
Reply
#5
Cheers for the ideas fellas. As for that script being converted to Python. Think this does the job. 

python:

import xbmc
import xbmcgui


class ReturnModifier:

    def __init__(self):
        windowFuncs = {
            12005: self.onFullScreenVideo,
            10000: self.onHomeWindow,
        }
        windowID = self.getWindowID()

        if windowID in windowFuncs:
            self.player = xbmc.Player()
            windowFuncs[windowID]()
        else:
            self.back()

    @staticmethod
    def back():
        xbmc.executebuiltin("Action(Back)")

    @staticmethod
    def isVideoFullscreen():
        xbmc.getCondVisibility("VideoPlayer.IsFullscreen")

    @staticmethod
    def isPlayerPaused():
        xbmc.getCondVisibility("Player.Paused")

    def getWindowID(self):
        return xbmcgui.getCurrentWindowId()

    def onFullScreenVideo(self):

        if not self.isPlayerPaused():
            self.player.pause()

        self.back()

    def onHomeWindow(self):
        self.back()

        if self.isVideoFullscreen and self.isPlayerPaused:
            self.player.pause()

if __name__ == "__main__":
    ReturnModifier()
Reply
#6
(2023-04-24, 07:22)scott967 Wrote: 2.  Try /playlist/info from full screen video.

I don't know how to do that. I'm using JSON FWIW. I did try ActivateWindow("movieinformation"), and while it invokes the right dialog, it fails to populate, reporting "Cast not available" and "No information available".
Reply

Logout Mark Read Team Forum Stats Members Help
Can this UI behaviour be changed?0