CDNetworks Documentation Cloud VoD Get Video Playback Code

Get Video Playback Code

Last update:2023-03-14 16:36:58

Get playback URL by video ID.

Request method POST/GET
URL https://api.cloudv.haplat.net/vod/videoManage/getPublishCode
Require Aunthentication Yes

Request parameter

Parameter Type Required Description
videoId string Yes the ID of the Video. You can get the video ID from the console or by calling the API Get Video List.
CodeType int No Playback code type :
- 0 (All)
- 2 (Swf Code)
- 4 (Video URL)
- 5 (Adaptive Code)
- 6 (Full-screen Preview video URL)
- 7 (Full-screen Preview Preview Adaptive Code)
The default is 0.

Response

data

Parameter Type Description
videoId string Video ID
encrypt int Whether video is encrypted :
- 0 (Unencrypted)
- 1 (Encrypted)
swfCode string Swf playback code.
autoCode string The adaptive playback code in which an H5 player is embedded.
Note: There is no adaptive playback code if the video is encrypted.
tryWatchAutoCode string Preview playback code.
Note: There is no preview playback code if the video is encrypted.
customCode string Customized playback code. If you need this, please contact customer service.
videoUrl array Video url list.
tryWatchVideoUrl array Full-screen Preview video Url List.

videoUrl and tryWatchVideoUrl

Parameter Type description
urlType string PC/Mobile
originUrl string ORIGINAL video URL
fluentUrl string LD video URL
sdUrl string SD video URL
highUrl string HD video URL
hdPullUrl string FHD video URL

Example

Input example

curl -X POST 
  http://api.cloudv.haplat.net/vod/videoManage/getPublishCode 
  -H 'content-type: application/x-www-form-urlencoded; charset=utf-8' 
  -H "Host: api.cloudv.haplat.net" 
  <Common Headers and Prameters>
  -d 'videoId=9B0F7BA8BCB9D056D4C24ADDBF821D10&codeType=0'

Note: For “Common Headers and Prameters” in the example, see Common Parameters to learn more.

Output Example

{
    "code": 200,
"data": {
"videoId ": 8731c067016b1000d7d05b5600000000,
        "encrypt": 0,
        “autoCode”:” https://cloudv.chinanetcenter.com/player/auto-play.action?videoId=9B0F7BA8BCB9D056D4C24ADDBF821D10&userId=6A313F452ADC20F7&playerType=11”,
        "swfCode": "https://cloudv.chinanetcenter.com/swf/player/6A313F452ADC20F7_9B0F7BA8BCB9D056D4C24ADDBF821D10_true_11/StrobeMediaPlayback.swf",
        "customCode": "",	
        "videoUrl": [
            {
                "fluentUrl": "",
                "hdPullUrl": "",
                "highUrl": "",
                "originUrl": "http://live.ovptest.haplat.net/live/201708/4101630234a74ee8864e56ea88e5d290_20170801171220/4101630234a74ee8864e56ea88e5d290_20170801171220_live2vod.mp4",
                "sdUrl": "",
                "urlType": "PC"
            },
            {
                "fluentUrl": "",
                "hdPullUrl": "",
                "highUrl": "",
                "originUrl": "http://live.ovptest.haplat.net/live/201708/4101630234a74ee8864e56ea88e5d290_20170801171220/4101630234a74ee8864e56ea88e5d290_20170801171220_live2vod.mp4",
                "sdUrl": "",
                "urlType": "Mobile"
            }
        ]
    },
    "message": "Success"
}

Error code

For common errors, please refer to Response.

Error code Description
1503 videoId cannot be empty.
1504 videoId contains unrecognizable characters.
1532 codeType input is invalid.
1502 The video does not exist.
1535 No permission to get playback code.
Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!