ktnrg45 / pyremoteplay

Python API for using PlayStation Remote Play
https://pyremoteplay.readthedocs.io/
GNU General Public License v3.0
29 stars 11 forks source link

Is there a way to get video frames in the async client example? #13

Closed ccarterc closed 2 years ago

ccarterc commented 2 years ago

I noticed the sync client example doesn't seem to work at all. It connects, but none of the controller actions work and it quickly disconnects the session.

The async example seems to work well as it waits for the session to be fully established and then begins sending actions which successfully get sent to the playstation. However if I try to look at video frames within the button action loop, device.sessions.receiver.video_frames results in error: File "<string>", line 1, in <module> AttributeError: 'NoneType' object has no attribute 'video_frames' . The same is true for device.session.receiver.get_video_frame and device.session.receiver.get_latest_video_frame .

Is there any chance you can provide an example of how to get a video frame in the async example?

I read the docs on PyAV and it shows there is a method: VideoFrame.to_image that works if you have PIL or Pillow, but I haven't been able to test it yet since I can't get a video frame.

ktnrg45 commented 2 years ago

Yes you have to pass a receiver in device.create_session() like in the sync example. So it would look like this:

receiver = QueueReceiver()

device.create_session(user, receiver=receiver)