tencent cloud

Feedback

How to Make VOD Videos Live Streaming-Like

Last updated: 2023-05-15 17:38:25
    Based on its playback control capability, VOD can add access controls of "playback time constraint" and "syncing playback progress" to VOD files to implement pseudo-live streaming. This allows you to distribute VOD videos as live streams at the scheduled time, thus saving costs and avoid the risks associated with live streaming.

    Strengths

    Benefit
    Description
    Low development costs
    To convert a VOD video to a common live stream for delivery, you need to use OBS to publish the video to the live streaming platform and deal with the compatibility issues by yourself. This incurs high development costs. VOD can implement pseudo-live streaming automatically for you. You only need to enable transcoding and hotlink protection.
    Low compliance risks
    You can moderate and edit VOD files in advance to avoid the risk of non-compliance.
    Ease of use and flexibility
    No live streaming rooms are needed and any videos can be used for pseudo-live streaming.
    There is no upper limit on concurrency. You can specify a start time for pseudo-live streaming and share the playback URL beforehand.

    Use Cases

    This feature is mainly used in scenarios where videos need to be recorded beforehand and viewed by users concurrently at a preset time. Viewers can get the playback URL in advance but cannot watch the video before the preset time.
    In pseudo-live streaming, viewers cannot change the playback speed. It is commonly used to stream online classes, concerts, and TV shows.

    Must-Knows

    Use limits

    Because pseudo-live streaming is essentially on-demand delivery, it lacks some capabilities of a real live stream:
    You cannot collect statistics for a pseudo-live streaming session.
    There is no clear indication of the start and end of a pseudo-live streaming session.
    You cannot pause/terminate an ongoing pseudo-live streaming session.
    You cannot block a pseudo-live streaming URL that has been distributed.
    You cannot dynamically change the video content (such as real-time transcoding and watermarking).

    Glossary

    Allowed watch time: A video URL can be provided to viewers in advance, but the content is not accessible before the specified start time or after the specified end time. Synced viewing: During a pseudo-live streaming session, all viewers watch synchronously with the same progress (there may be a difference of a few minutes).

    Prerequisites

    You have signed up for a Tencent Cloud account and logged in.
    You have activated CSS and VOD.
    You have recorded a live stream. For detailed directions, see Recording to VOD and Processing Video.

    Directions

    Step 1. Upload a video to VOD

    1. Log in to the VOD console and select Application Management on the left sidebar.
    2. Select the target application.
    3. Go to Media Assets > Video/Audio Management and click Upload.
    
    You can also use other upload methods. For details, see Media Upload Overview and Recording to VOD and Processing Video.

    Step 2. Transcode the video to HLS

    1. Videos for pseudo-live streaming must be in HLS format. You can follow the steps in Transcoding Task Initiation to transcode an uploaded video into HLS format (choose a transcoding template that fits your needs).
    2. After the transcoding is finished, you can view the URL of the HLS file generated on the Video/Audio Management of the console or get the URL via event notifications.
    

    Step 3. Enable key hotlink protection

    1. Hotlink protection is required for pseudo-live streaming. To enable hotlink protection, go to the VOD console. Click Application Management on the left sidebar and select the target application. Go to Distribution and Playback > Domain Name, find your domain, and click Set on the right.
    
    2. Under the Access Control tab, enable referer hotlink protection or key hotlink protection.
    
    3. For details on how to configure hotlink protection, see Setting Hotlink Protection. After the configuration, save the key for calculating the hotlink protection signature.
    

    Step 4. Calculate the hotlink protection signature

    Signature calculation formula

    sign = md5(KEY + Dir + t + plive + exper + rlimit + us)
    Note:
    Compared with standard key hotlink protection, hotlink protection for pseudo-live streaming has an additional parameter plive, which is also included in the signature calculation formula.
    Parameter
    Value
    Description
    KEY
    11111111
    The key you set when enabling key hotlink protection.
    Dir
    /dir1/dir2/
    The part of the original video URL with the filename myVideo.mp4 removed.
    t
    5a71afc0
    The expiration timestamp (1517400000) converted to hexadecimal.
    plive
    5e344f00
    The start time (UTC+8) of the pseudo-live streaming session, in Unix timestamp format. For example, 1577808000 means 00:00:00 on January 1, 2020.
    exper
    0
    The preview duration. 0 means no limit will be set.
    rlimit
    0
    The number of IP addresses allowed to play the video. 0 means no limit will be set.
    us
    test
    The generated random string.
    Suppose you have a video stored in VOD, and the URL of its HLS-format file (not the original video URL) is http://1250000000.vod2.myqcloud.com/vodtranscq125000000/12345678/v.f240.m3u8. The other parameters are as follows:
    Hotlink protection key: 11111111.
    Expiration time (t): 5e5a8a80 (March 1, 2020 00:00:00).
    Start time (plive): 5e344f00 (February 1, 2020 00:00:00).
    Preview duration (exper): 0 (no limit).
    Maximum number of IP addresses allowed (rlimit): 0 (no limit).
    Random string (us): test.
    1. Calculate the signature based on the signature calculation format:
    sign = md5(11111111/vodtranscq125000000/12345678/5e5a8a805e344f0000test) = 0af5018df88c00e6629e0fb8939277dd
    2. Add the signature generated to the query string of the HLS URL to get the final hotlink protection URL:
    http://1250000000.vod2.myqcloud.com/vodtranscq125000000/12345678/v.f240.m3u8?t=5e5a8a80&plive=5e344f00&exper=0&rlimit=0&us=test&sign=0af5018df88c00e6629e0fb8939277dd
    Note:
    The parameters in the query string must be in the same order as when sign is calculated, which is t-plive-exper-rlimit-us-sign.
    To facilitate your development, we provide a hotlink protection signature generation tool. Just enter the necessary parameters, and you will get the signature and the final hotlink protection URL.

    Watching Pseudo-Live Streaming

    Open the above hotlink protection URL in a player that supports HLS playback (such as Safari, VLC, and PotPlayer) to watch pseudo-live streaming.
    Note:
    Chrome does not support HLS playback. You need to install a plugin.
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support