Issue using PlayMedia with Smart Playlist (in keyboard/remote.xml)



I have a Smart Playlist that just keeps track of recently played episodes (as per the Wiki: https://kodi.wiki/view/Smart_playlists/E…s_episodes)

xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="episodes">
    <name>Recently Played</name>
    <match>all</match>
    <rule field="lastplayed" operator="inthelast">
        <value>2 days</value>
    </rule>
    <rule field="inprogress" operator="true" />
    <limit>10</limit>
    <order direction="descending">lastplayed</order>
</smartplaylist>

What I want to do is bind a key/remote button to play the 2nd entry on that list (i.e. to play whatever was playing before the current episode was stopped).

(This is to solve a common scenario where my wife and I are watching one thing, the kids interrupt and one of has to go help them with homework or whatever, and the other is watching some other show in the meantime…i.e to make it really easy to switch back and forth between two currently in progress episodes basically).

I thought about writing an addon to do it, but on research it seems it should be achievable by simply combining the above Smart Playlist and a PlayMedia command:

xml:

<z mod="ctrl">PlayMedia(special://profile/playlists/video/Recently Played.xsp,playoffset=2,resume)</z>

However, that PlayMedia command always plays the first entry of the list, and does not resume.  In the logs I see:

Code:

2024-10-24 14:03:32.533 T:37752   debug <general>: CInputManager::HandleKey: ctrl-z (0x1f05a) pressed, window 10000, action is PlayMedia(special://profile/playlists/video/Recently Played.xsp,playoffset=2,resume)
2024-10-24 14:03:32.536 T:37752   error <general>: CFileItem::LoadDetails: Error filling item details (path=special://profile/playlists/video/Recently Played.xsp)
2024-10-24 14:03:32.542 T:37752   debug <general>: CApplication:TonguerocessAndStartPlaylist(Recently Played, 1)
2024-10-24 14:03:32.547 T:37752   debug <general>: CPlayerCoreFactory::GetPlayers(C:\Kodi\Kodi Library\TV02\Foundation (2021)\Season 01\Foundation (2021) - S01E04 - Barbarians at the Gate - WEBDL-2160p - h265 EAC3 Atmos HDR.mkv)

I have tried playoffsets of both 1 and 2 (it might be zero indexed?) – but the offset is not working, and nor is the instruction to resume, so it plays only the first thing in that list and only from the beginning.

Any ideas?