Skip to content

How to get livestream URL? #1181

@roger-

Description

@roger-

Is there an example of how to get the livestream URL and play it in VLC, etc.?

I tried an example from here with a Blink Mini and got a tcp:// URL, but it wouldn't play in VLC/ffplay:

import asyncio
import os.path
from aiohttp import ClientSession
from blinkpy.blinkpy import Blink
from blinkpy.auth import Auth, BlinkTwoFARequiredError
from blinkpy.helpers.util import json_load


async def start():
    session = ClientSession()
    blink = Blink(session=session)
    if os.path.exists("blink.json"):
        auth = Auth(await json_load("blink.json"), session=session)
        blink.auth = auth
        
    try:
        await blink.start()
    except BlinkTwoFARequiredError:
        await blink.prompt_2fa()
    await blink.save("blink.json")

    return blink


async def go():
    blink = await start()
    camera = blink.cameras["Garage"]
    stream = await camera.init_livestream()
    await stream.start()
    print(stream.url)
    await stream.feed()
    print('done')

asyncio.run(go())

Gives:

tcp://127.0.0.1:33893
Insufficient data for payload: 114 bytes, expected 1316
Connection error. Endpoint https://rest-u007.immedia-semi.com/network/xxx/command/yyy/done/ possibly down or throttled. Error: 
done
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x71dc436a2ae0>
Unclosed connector
connections: ['deque([(<aiohttp.client_proto.ResponseHandler object at 0x71dc42a372f0>, 171512.857541013)])']
connector: <aiohttp.connector.TCPConnector object at 0x71dc42c2b320>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions