Can an Apple TV play a streaming URL?

Hi All,

Does the Apple TV 4 support playing streaming URLs?

I’ve been poking around the docs to see if I can send a streaming URL to the apple_tv media player.

I tried sending the following by calling the media_player.play_media service:

{ "entity_id": "media_player.apple_tv", "media_content_id": "http://abcnews24mha-
lh.akamaihd.net/i/abcnews24nospe_1@70019/master.m3u8", "media_content_type": "VIDEO" }

Which resulted in the following log file entries:

2017-09-12 09:35:56 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]:     domain=media_player, service=play_media, service_data=entity_id=media_player.apple_tv,     media_content_id=http://abcnews24mha-lh.akamaihd.net/i/abcnews24nospe_1@70019/master.m3u8,     media_content_type=VIDEO, service_call_id=1961408336-31>
2017-09-12 09:35:56 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/tasks.py", line 179, in _step
    result = coro.send(None)
  File "/usr/lib/python3.6/site-packages/homeassistant/core.py", line 1025, in _event_to_service_call
    yield from service_handler.func(service_call)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/__init__.py", line 408, in async_service_handler
    yield from getattr(player, method['method'])(**params)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/media_player/apple_tv.py", line 166, in     async_play_media
    yield from self.atv.airplay.play_url(media_id)
  File "/usr/lib/python3.6/site-packages/pyatv/internal/apple_tv.py", line 462, in play_url
    return (yield from self.player.play_url(url, position))
  File "/usr/lib/python3.6/site-packages/pyatv/airplay/player.py", line 44, in play_url
    yield from self._wait_for_media_to_end()
  File "/usr/lib/python3.6/site-packages/pyatv/airplay/player.py", line 64, in _wait_for_media_to_end
    parsed = plistlib.loads(data)
  File "/usr/lib/python3.6/plistlib.py", line 1006, in loads
    fp, fmt=fmt, use_builtin_types=use_builtin_types, dict_type=dict_type)
  File "/usr/lib/python3.6/plistlib.py", line 991, in load
    raise InvalidFileException()
plistlib.InvalidFileException: Invalid file

I confirmed the URL works by navigating to it in Safari on my iPad. It works fine as a m3u8.

Thanks,
Simon.

Yes, it is possible to play streams but the device is extremely picky about what you send to it. I do not think that m3u(8) is supported. You could try downloading the file and manually pick an item from the list (it’s plain text) and see if it works better.