pyatv icon indicating copy to clipboard operation
pyatv copied to clipboard

error in fetch metadata in "playing" command

Open Ajay-ue opened this issue 1 year ago • 9 comments

Describe the bug

step 1 => use iphone to airplay a video to a TV (say sony tv id xyz). step2 => run atvremote with atvremote --id xyz playing step3 => no metadata fetched.

Error log

atvremote --debug --id CD:98:ED:C1:F7:85 playing
2024-07-04 20:12:45 DEBUG [pyatv.scripts]: Running with pyatv 0.14.5
2024-07-04 20:12:45 DEBUG [pyatv.storage.file_storage]: Loading settings from /home/user/.pyatv.conf
2024-07-04 20:12:45 DEBUG [pyatv.support.net]: Binding on *:5353
2024-07-04 20:12:45 DEBUG [pyatv.support.net]: Binding on 127.0.0.1:0
2024-07-04 20:12:45 DEBUG [pyatv.support.net]: Binding on 192.168.1.123:0
2024-07-04 20:12:46 DEBUG [pyatv.core.scan]: Auto-discovered SONY KD-55X82L at 192.168.1.64:7000 via Protocol.AirPlay ({'acl': '0', 'deviceid': 'CD:98:ED:C1:F7:85', 'features': '0x7F8AD0,0x18BCF46', 'fex': '0Ip/AEbPiwFA', 'rsf': '0x3', 'fv': 'p20.6.7480.0852', 'at': '0x1', 'flags': '0xa44', 'model': 'KD-55X82L', 'integrator': 'SONY', 'manufacturer': 'Sony', 'serialnumber': '7024755', 'protovers': '1.1', 'srcvers': '377.40.00', 'pi': 'CD:98:ED:C1:F7:85', 'psi': '00000000-0000-0000-0000-CD98EDC1F785', 'gid': 'BB0E979C-A7B1-4B61-909E-7E6B5A00F360', 'gcgl': '0', 'isgroupleader': '0', 'pk': '08cb0dcd2b70e915ba93a8aaaaf5f4e8f63c6e289f5e1a527ef0853fd7157090'})
2024-07-04 20:12:46 INFO [pyatv.scripts.atvremote]: Auto-discovered SONY KD-55X82L at 192.168.1.64
2024-07-04 20:12:46 DEBUG [pyatv]: Loading settings from FileStorage:/home/user/.pyatv.conf
2024-07-04 20:12:46 DEBUG [pyatv.core.facade]: Adding handler for protocol Protocol.AirPlay
2024-07-04 20:12:46 DEBUG [pyatv.protocols.airplay]: RAOP supported but no service present, adding new service
2024-07-04 20:12:46 DEBUG [pyatv.core.facade]: Adding handler for protocol Protocol.RAOP
2024-07-04 20:12:46 DEBUG [pyatv.protocols.airplay]: Remote control not supported by device
2024-07-04 20:12:46 DEBUG [pyatv.core.facade]: Adding handler for protocol Protocol.RAOP
2024-07-04 20:12:46 DEBUG [pyatv.core.facade]: Connecting to protocol: Protocol.AirPlay
2024-07-04 20:12:46 DEBUG [pyatv.core.facade]: Connected to protocol: Protocol.AirPlay
2024-07-04 20:12:46 DEBUG [pyatv.core.facade]: Connecting to protocol: Protocol.RAOP
2024-07-04 20:12:46 DEBUG [pyatv.core.facade]: Connected to protocol: Protocol.RAOP
2024-07-04 20:12:46 DEBUG [pyatv.core.facade]: Protocol Protocol.RAOP already set up, ignoring
2024-07-04 20:12:46 DEBUG [pyatv.core.facade]: Power management not supported by any protocols
  Media type: Unknown
Device state: Idle
2024-07-04 20:12:46 DEBUG [pyatv.scripts.atvremote]: Waiting for 0 remaining tasks

How to reproduce the bug?

step 1 => use iphone to airplay a video to a TV (say sony tv id xyz). step2 => run atvremote with atvremote --id xyz playing step3 => no metadata fetched.

What is expected behavior?

metadata should be received

Operating System

linux

Python

3.8

pyatv

pyatv 0.14.5

Device

sony tv

Additional context

step 1 => use iphone to airplay a video to a TV (say sony tv id xyz). step2 => run atvremote with atvremote --id xyz playing step3 => no metadata fetched.

Ajay-ue avatar Jul 04 '24 14:07 Ajay-ue

Looks like you haven't paired any protocols. Trying running atvremote wizard, pick your Apple TV and follow the instructions. Then try again.

postlund avatar Jul 04 '24 15:07 postlund

Its already paired ( device only shows airplay port 7000) Name: SONY KD-55X82L Model/SW: KD-55X82L, Unknown OS Address: 192.168.1.64 MAC: CD:98:ED:C1:F7:85 Deep Sleep: False Identifiers:

  • CD:98:ED:C1:F7:85 Services:
  • Protocol: AirPlay, Port: 7000, Credentials: 08cb0dcd2b70e915ba93a8aaaaf5f4e8f63c6e289f5e1a527ef0853fd7157090:ab46d1d6ed65df692e31f8be416f2303c2a4812f82b10eb8856c71cff4ad7e55:43443a39383a45443a43313a46373a3835:39653366353235342d343539302d343035622d613863332d656138313734373934343762, Requires Password: False, Password: None, Pairing: Mandatory

Ajay-ue avatar Jul 05 '24 10:07 Ajay-ue

Oh, I missed that it was a 3rd party AirPlay device. AirPlay doesn't support fetching metadata from other clients when someone is streaming to a device, so this is as good as it's gonna get I'm afraid.

postlund avatar Jul 05 '24 10:07 postlund

But if you airplay from one phone to this device, and then you pickup another iphone, somehow other iphone knows whats being played (in airplay drop menu it shows the device and one moving line about the content) ... probably some kind of eventing ?

Ajay-ue avatar Jul 05 '24 10:07 Ajay-ue

I know this use case would work with Apple TVs or HomePods, but I wouldn't expect it to work with other devices. Do you mean that is the case here?

postlund avatar Jul 31 '24 15:07 postlund

I have the same issue with my homepod too:

DEBUG:pyatv.core.scan:Auto-discovered Living Room at 192.168.1.132:7000 via Protocol.AirPlay ({'acl': '0', 'btaddr': '7A:04:80:86:74:24', 'deviceid': 'C2:EB:29:EB:63:83', 'c': '2', 'fex': 'AMp/StBrNbwQoS4', 'features': '0x4A7FCA00,0xBC356BD0', 'flags': '0x1b8c84', 'gid': 'B0EA4E09-CE71-40A7-8C22-6AF7669D839E', 'igl': '0', 'gcgl': '0', 'pgid': 'B0EA4E09-CE71-40A7-8C22-6AF7669D839E', 'pgcgl': '0', 'model': 'AudioAccessory5,1', 'protovers': '1.1', 'pi': '30bad54c-db0a-4d6b-bbb2-5f0231bfe646', 'psi': 'C1EB29EB-6383-4F42-A47E-80DB6DE5B718', 'pk': '75b19924d16b64a542b854170921e25e0e1e8249157cbca8e8391bf46e1d4164', 'srcvers': '830.6.1', 'osvers': '18.1', 'vv': '1'})
DEBUG:pyatv.core.scan:Auto-discovered Living Room at 192.168.1.132:49153 via Protocol.Companion ({'rpmac': '2', 'rphn': '353a35d774c8', 'rpfl': '0x6279A', 'rpha': 'cc3e66d52646', 'rpmd': 'AudioAccessory5,1', 'rpvr': '610.31.1', 'rpad': '2d0abb372812', 'rphi': '7759a5a0ee0a', 'rpba': '37:29:C8:13:23:57'})
DEBUG:pyatv.core.scan:Auto-discovered C2EB29EB6383@Living Room at 192.168.1.132:7000 via Protocol.RAOP ({'cn': '0,1,2,3', 'da': 'true', 'et': '0,3,5', 'ft': '0x4A7FCA00,0xBC356BD0', 'sf': '0x1b8c84', 'md': '0,1,2', 'am': 'AudioAccessory5,1', 'pk': '75b19924d16b64a542b854170921e25e0e1e8249157cbca8e8391bf46e1d4164', 'tp': 'UDP', 'vn': '65537', 'vs': '830.6.1', 'ov': '18.1', 'vv': '1'})
DEBUG:pyatv:Loading settings from MemoryStorage
DEBUG:pyatv.core.facade:Adding handler for protocol Protocol.AirPlay
DEBUG:pyatv.protocols.airplay:Remote control not supported by device
DEBUG:pyatv.protocols.companion:Not adding Companion as credentials are missing
DEBUG:pyatv.core.facade:Adding handler for protocol Protocol.RAOP
DEBUG:pyatv.core.facade:Connecting to protocol: Protocol.AirPlay
DEBUG:pyatv.core.facade:Connected to protocol: Protocol.AirPlay
DEBUG:pyatv.core.facade:Connecting to protocol: Protocol.RAOP
DEBUG:pyatv.core.facade:Connected to protocol: Protocol.RAOP
DEBUG:pyatv.core.facade:Power management not supported by any protocols
found:
name: Living Room | type: HomePod Mini, tvOS 18.1
setting credentials
connecting
  Media type: Unknown
Device state: Idle

Tarlispace69 avatar Oct 02 '24 17:10 Tarlispace69

@Tarlispace69 Looks like you are missing credentials for most (or all) protocols. Run the wizard to pair and then try again.

postlund avatar Oct 02 '24 18:10 postlund

After I disabled password authentication on the homepod it worked

edit: To be clear I paired it earlier using pyatv in my own code and stored the credentials in a json file, then set the stored credentials using set_credentials() before connecting. However after disabling password authentication for devices on the same network file streaming works now too

Tarlispace69 avatar Oct 02 '24 18:10 Tarlispace69

Ah, yes, password is only supported for RAOP at the moment. Would be good to fix that at some point.

postlund avatar Oct 02 '24 19:10 postlund