Stream Video File - Via Third-Party URL

This guide will show you how to upload video files to LiveAPI and get them ready for streaming to your audience.

There are 2 ways to upload a video to LiveAPI:

  1. Fetch via 3rd-party URL
  2. Directly upload file from local machine

On this page, we explain how to fetch a file from a 3rd-party URL to LiveAPI server. This method is helpful if your files are hosted somewhere else (for example, Google, Dropbox, or Amazon), and you want to ingest the file directly to LiveAPI.

Before you start

You will need access to the following:

  • LiveAPI Access Token: Refer to the Authentication in LiveAPI article to learn how to generate an access token via the LiveAPI dashboard.

  • The direct link to the file you would like to fetch from.

🚧

Note

Ensure that the third-party link is a direct link to the video file and not to a page that contains the video.

For example, if you would like to import a video from Dropbox, you would want to use domain dl.dropboxusercontent.com instead of dropbox.com as guided here.

Fetch a video from a 3rd Party URL

Once you have created an access token, you can fetch your video file to LiveAPI by calling POST /videos and set the input_url to the direct link of the video.

Sample Request

curl --location --request POST 'https://api.liveapi.com/videos' \
--header 'Content-Type: application/json' \
--header 'Authorization: {your_authentication}' \
--data-raw '{
     "input_url": "https://assets.liveapi.com/videos/LiveAPI_Sample.mp4"
}'

Sample Response

The method returns a video object that includes information about the video.

🚧

Please note that when returning this response, the video can still be in fetching progress and not finished fetching yet, so you won't see any video's media info here.

To know when the video is finished fetching, you can set up a webhook to receive the video-downloaded event.

{
    "_id": "6216125220f85ec400c7485t",
    "playback": {
        "embed_url": "https://player.liveapi.com/vod/620e0ba1ce8f11ddde571d1c/vdee7da660949611ec9888",
        "hls_url": "https://video.liveapi.com/620e0ba1ce8f11ddde571d1c/vdee7da660949611ec9888.mp4/index.m3u8"
    },
    "user": "620e0ba1ce8f11ddde571m3e",
    "environment": "production",
    "organization": "620e0ba2ce8f11ddde571e5e",
    "creation_time": "2022-02-23T10:54:10.937Z"
}

After the video is done fetching, you can call the Get video details endpoint to get the full information about the video including the media info.

Sample Response

{
    "_id": "6216125220f85ec400c7485t",
    "playback": {
        "embed_url": "https://player.liveapi.com/vod/620e0ba1ce8f11ddde571d1c/vdee7da660949611ec9888",
        "hls_url": "https://video.liveapi.com/620e0ba1ce8f11ddde571d1c/vdee7da660949611ec9888.mp4/index.m3u8"
    },
    "user": "620e0ba1ce8f11ddde571m3e",
    "environment": "production",
    "organization": "620e0ba2ce8f11ddde571e5e",
    "media_info": {
        "duration": "15.900",
        "track": [
            {
                "@type": "General",
                "VideoCount": "1",
                "AudioCount": "1",
                "FileExtension": "mp4",
                "Format": "MPEG-4",
                "FileSize": "2056899",
                "Duration": "15.900",
                "OverallBitRate_Mode": "VBR",
                "OverallBitRate": "1034918",
                "FrameRate": "30.000"
            },
            {
                "@type": "Video",
                "Format": "AVC",
                "Format_Profile": "Main",
                "Format_Level": "4.1",
                "CodecID": "avc1",
                "BitRate": "685883",
                "Width": "1920",
                "Height": "1080",
                "DisplayAspectRatio_String": "16:9",
                "FrameRate_Mode": "CFR",
                "FrameRate": "30.000"
            },
            {
                "@type": "Audio",
                "Format": "AAC",
                "CodecID": "mp4a-40-2",
                "BitRate": "317374",
                "Channels": "2",
                "ChannelPositions": "Front: L R",
                "SamplingRate": "48000"
            }
        ]
    },
    "creation_time": "2022-02-23T10:54:10.937Z"
}

Supported formats

LiveAPI can fetch all formats that ffmpeg supports. For the full list, you can refer to here.

πŸ“˜

Files are kept 15 days after account is expired

When your subscription plan ends, LiveAPI will continute to store your files for the next 15 days. After that, the files will be deleted permanently.


What’s Next