Live Station overview
    • PDF

    Live Station overview

    • PDF

    Article Summary

    Overview

    Live Station is a real-time video encoding platform that provides all the necessary features for building a live broadcasting service.
    Live Station allows you to create several multi-bitrate output streams quickly and easily with a single RTMP original stream through its web interface. You can also packetize a video into HLS and DASH formats and send it.
    It provides not only a feature that converts high-definition live video into various image quality levels, but also a real-time digital video recorder (DVR). You can also build a replay service using the video files you've created.

    It also provides the re-streaming feature where you can simultaneously transmit live media videos to other platforms easily. You can transmit videos simultaneously to various broadcasting platforms, such as YouTube, Twitch, and Afreeca TV, and manage the transmission statuses at once in Live Station.

    Common settings

    Live Station API URL

    https://livestation.apigw.ntruss.com/api/v2
    

    Request headers

    Header nameRequirement statusDescription
    x-ncp-apigw-timestampYESIt indicates the time elapsed since January 1, 1970, 00:00:00 UTC in milliseconds, and the request is considered invalid if the time difference from the API Gateway server is 5 minutes or longer
    x-ncp-apigw-timestamp:{Timestamp}
    x-ncp-iam-access-keyYESValue of access key ID issued in the NAVER Cloud Platform portal
    x-ncp-iam-access-key:{Sub Account Access Key}
    x-ncp-apigw-signature-v2YESSignature encrypted with the access key ID value and secret key
    x-ncp-apigw-signature-v2:{API Gateway Signature}
    Content-TypeYESSpecifies the request body content type as application/json
    Content-Type: application/json
    x-ncp-region_codeYESRegion code (KR)

    Authentication header

    API Gateway authentication is required to use the Live Station API.

    Refer to NAVER Cloud Platform API for more detailed guides related to API Gateway authentication.

    Creating AUTHPARAMS

    AUTHPARAMS request example

    curl -i -X GET \
       -H "x-ncp-apigw-timestamp:1505290625682" \
       -H "x-ncp-iam-access-key:D78BB444D6D3C84CA38A" \
       -H "x-ncp-apigw-signature-v2:WTPItrmMIfLUk/UyUIyoQbA/z5hq9o3G8eQMolUzTEo=" \
       -H "x-ncp-region_code:KR" \
    'https://livestation.apigw.ntruss.com/api/v2/channels'
    
    • Create a signature (add a new line with \n)

      • Create a StringToSign appropriate for your request, encrypt it with your secret key and the HMACSHA256 algorithm, and encode it with Base64.

      • This value is used as x-ncp-apigw-signature-v2.

        RequestsStringToSign
        GET /api/v2/channels?pageNo=1
        x-ncp-apigw-timestamp={timestamp}
        x-ncp-iam-access-key={accesskey}
        x-ncp-apigw-signature-v2={signature}
        GET /api/v2/channels?pageNo=1
        {timeStamp}
        {accessKey}
    • Sample code

    public String makeSignature() {
        String space = " ";					// Space
        String newLine = "\n";  				// Line break
        String method = "GET";  				// HTTP method
        String url = "/api/v2/channels?pageNo=1";	// Full URL under "/" (including query strings), excluding the domain
        String accessKey = "{accessKey}";		// access key id (from portal or Sub Account)
        String secretKey = "{secretKey}";		// secret key (from portal or Sub Account)
        String timestamp = String.valueOf(System.currentTimeMillis());		// Current timestamp (epoch, millisecond)
    
        String message = new StringBuilder()
            .append(method)
            .append(space)
            .append(url)
            .append(newLine)
            .append(timestamp)
            .append(newLine)
            .append(accessKey)
            .toString();
    
        SecretKeySpec signingKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), "HmacSHA256");
        Mac mac = Mac.getInstance("HmacSHA256");
        mac.init(signingKey);
    
        byte[] rawHmac = mac.doFinal(message.getBytes("UTF-8"));
        String encodeBase64String = Base64.encodeBase64String(rawHmac);
    
      return encodeBase64String;
    }
    
    /*
    https://code.google.com/archive/p/crypto-js/
    https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/crypto-js/CryptoJS%20v3.1.2.zip
    */
    
    /*
    CryptoJS v3.1.2
    code.google.com/p/crypto-js
    (c) 2009-2013 by Jeff Mott. All rights reserved.
    code.google.com/p/crypto-js/wiki/License
    */
    <script type="text/javascript" src="./CryptoJS/rollups/hmac-sha256.js"></script>
    <script type="text/javascript" src="./CryptoJS/components/enc-base64.js"></script>
    
    function makeSignature(secretKey, method, url, timestamp, accessKey) {
    	var space = " ";
    	var newLine = "\n";
    
    	var hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, secretKey); // secret key
    	hmac.update(method);		// HTTP method
    	hmac.update(space);		// Space
    	hmac.update(url);		// Full URL under "/" (including query strings), excluding the domain
    	hmac.update(newLine);		// Line break
    	hmac.update(timestamp);		// Current timestamp (epoch, millisecond)
    	hmac.update(newLine);		// Line break
    	hmac.update(accessKey);		// access key (from portal or iam)
    
    	var hash = hmac.finalize();
    
    	return hash.toString(CryptoJS.enc.Base64);
    }
    
    import sys
    import os
    import hashlib
    import hmac
    import base64
    import requests
    import time
    
    def	make_signature():
    	timestamp = int(time.time() * 1000)
    	timestamp = str(timestamp)				# Current timestamp (epoch, millisecond)
    
    	access_key = "{accessKey}"				# access key id (from portal or Sub Account)
    	secret_key = "{secretKey}"				# secret key (from portal or Sub Account)
    	secret_key = bytes(secret_key, 'UTF-8')
    
    	method = "GET"						# HTTP method
    	uri = "/api/v2/channels?pageNo=1"			# Full URL under "/" (including query strings), excluding the domain
    
    	message = method + " " + uri + "\n" + timestamp + "\n"
    	+ access_key
    	message = bytes(message, 'UTF-8')
    	signingKey = base64.b64encode(hmac.new(secret_key, message, digestmod=hashlib.sha256).digest())
    	return signingKey
    
    function makeSignature() {
    	nl=$'\\n'
    
    	TIMESTAMP=$(echo $(date +%s000))	# Current timestamp (epoch, millisecond)
    	ACCESSKEY="{accessKey}"				# access key id (from portal or Sub Account)
    	SECRETKEY="{secretKey}"				# secret key (from portal or Sub Account)
    	METHOD="GET"					# HTTP method
    	URI="/api/v2/channels?pageNo=1"		# Full URL under "/" (including query strings), excluding the domain
    
    	SIG="$METHOD"' '"$URI"${nl}
    	SIG+="$TIMESTAMP"${nl}
    	SIG+="$ACCESSKEY"
    
    	SIGNATURE=$(echo -n -e "$SIG"|iconv -t utf8 |openssl dgst -sha256 -hmac $SECRETKEY -binary|openssl enc -base64)
    }
    

    Live Station API request configuration

    Header
      x-ncp-apigw-timestamp:{Timestamp}
      x-ncp-iam-access-key:{Sub Account Access Key}
      x-ncp-apigw-signature-v2:{API Gateway Signature}
      x-ncp-region_code:KR
      Content-Type:application/json
    Body
      Json Object
    URL
      https://livestation.apigw.ntruss.com/api/v2/{action}
    

    Live Station API request sample

    curl -i -s -X POST \
       -H "Content-Type:application/json" \
       -H "x-ncp-apigw-timestamp:1521787414578" \
       -H "x-ncp-iam-access-key:6uxz1nKkcYwUjWRG5Q1V7NsW0i5jErlu2NjBXXgy" \
       -H "x-ncp-apigw-signature-v2:iJFK773KH0WwQ79PasqJ+ZGixtpDQ/abS57WGQdld2M=" \
       -H "x-ncp-region_code:KR" \
       "https://livestation.apigw.ntruss.com/api/v2/channles"\
       -d "{ \"name\": \"api-guide\", \"qualitySetId\": 1234, \"cdnType\": \"CDN_PLUS\" }"
    

    Live Station API Content-Type

    application/json is used for the content-type of all data delivered through Live Station API HTTP requests and response bodies.


    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.