unifiedremote / Remotes

http://www.unifiedremote.com
202 stars 136 forks source link

potplayer keyboard shortcuts #87

Open creatv21 opened 7 years ago

creatv21 commented 7 years ago

i added this in layout.xml file (in unified/main/ daum pot player)

<row>
        <button text="audio" ontap="audio" />
        <button text="subs" ontap="subs" />
</row>

and this in remote.lua file (in unified/main/ Daum pot player)

--@help audio
actions.audio = function ()
    actions.switch();
    kb.stroke("A");
end

--@help subs
actions.subs = function ()
    actions.switch();
    kb.stroke("S");
end

audio and subs buttons appear in android app but it doesn't work. in potplayer I use "A" for audio track cycle and "S" for subtitles cycle. any help please

DarkPreacher commented 5 years ago

Hope I'm not too late… For me it works like so:

<row>
    <button icon="mic" onTap="audio" />
    <button icon="select" onTap="subs" />
</row>

maybe onTap is case sensitive, I don't know. And for remote.lua:

--@help Switch audio
actions.audio = function ()
    keyboard.stroke("alt", "a");
end

--@help Subtitles On/Off
actions.subs = function ()
    keyboard.stroke("alt", "h");
end
DarkPreacher commented 5 years ago

Although I'd recommend to do it with raw commands:

local CMD_SWITCH_AUDIO      = 36799;
local CMD_SWITCH_SUBS       = 36899;

and

--@help Switch audio
actions.switch_audio = function ()
    actions.command(CMD_SWITCH_AUDIO);
end

--@help Switch subtitles
actions.switch_subs = function ()
    actions.command(CMD_SWITCH_SUBS);
end