postlund / pyatv

A client library for Apple TV and AirPlay devices
https://pyatv.dev
MIT License
839 stars 91 forks source link

FastForwardBegin = 8 #2230

Open nfreeze opened 8 months ago

nfreeze commented 8 months ago

What do you need help with?

Hi, I am trying to find the command to fast forward. I see that in pyatv/protocols/companion/api.py there is a reference to FastForwardBegin = 8 but when i do atvremote commands I don't see any fast forward command in there. How do I send a fast forward command? This is similar to pressing and holding the right key on the appletv remote.

postlund commented 8 months ago

Fast forwarding/reverse is currently not supported. I think it mostly is because no one has requested it. Would have to try it out to ensure it actually works, but would otherwise be really easy to implement. Should be done for both MRP and Companion.

zehnm commented 3 months ago

Fast forward and rewind would be a great addition!

I quickly checked if MediaControlCommand.FastForwardBegin actually works with the companion protocol by replacing the channel_up and channel_down functions:

https://github.com/postlund/pyatv/blob/0a0720dbd68b2ed763388290742d922afdcfb8f2/pyatv/protocols/companion/__init__.py#L337-L343

with

    async def channel_up(self) -> None:
        await self.api.mediacontrol_command(MediaControlCommand.FastForwardBegin)

    async def channel_down(self) -> None:
        await self.api.mediacontrol_command(MediaControlCommand.FastForwardEnd)

and fast forward works (in Apple TV+)!

How to get that properly implemented with a FastForward/Rewind feature is another question :-) I'd have to find time to figure out the inner workings of pyatv.

One question: there is only one speed level, multiple FastForwardBegin commands don't change the fast forward speed as with the original remote. Any idea if that would be possible with the companion or MRP protocols?

zehnm commented 3 months ago

there is only one speed level

I've pressed comment too fast! While in fast forward mode, remote_control.right() will increase the speed 👍

postlund commented 3 months ago

@nfreeze started the work here: https://github.com/postlund/pyatv/pull/2363