请求地址
HTTP请求方式
GET
请求参数
名称
|
格式
|
是否可空
|
说明
|
AppId
|
String
|
否
|
该系统在开放平台中的ID
|
Timestamp
|
String
|
否
|
时间参数。时间验证与服务器时间误差不得超过10分钟(600秒),以北京时间为准。
获取方法:C#: long nowTime = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000 ;
Javascript: Math.round(new Date().getTime() / 1000); 结果例如:1369898793
|
Token
|
String
|
否
|
Timestamp +AppSecret在进行MD5加密后的字符串(转换后字母都为小写),AppSecret为该系统在开放平台中的密钥)
例如: Timestamp为1370585811,AppSecret为0123456789,加密前的字符串:13705858110123456789,加密后的字符串:c0c5ad4975c735e1c856d6a6b5d4310b
|
Id
|
String
|
否
|
视频Id
|
返回结果
JSON示例
{
"AuthMsg":
{"ResultCode":"1",
"ResultMessage":"OK"
},
"VideoModel":
{"Id":"0260bf86-d894-41b7-adb6-b39b4fc3c1a8",
"VideoTitle":"测试视频",
"Description":"描述",
"Tags":"标签1,标签2,标签3",
"Actors":"演员",
"Status":1,
"CreateDate":"2014-11-13T00:00:00",
"CreateUser":"zhangsan",
"PicSavePath":"http://192.168.1.56:8087/Picture/testPic.jpg"
},
"MediaSever":
{"PlayURL":"http://192.168.1.106:10007/",
"MobilePlayURL":"http://192.168.1.106:10009/",
"DownloadURL":"http://192.168.1.106:10008/"
},
"VideoPlayFile":
[{"VideoURL":"20141125/five_800k.mp4",
"Bitrate":800,
"BitrateLabel":"高清"
},
{"VideoURL":"20141125/five_500k.mp4",
"Bitrate":500,"BitrateLabel":"标清"
}
]
}
其他说明
参数PicSavePath为视频图片完整地址,可以在路径后面加"?t=4",来请求不同大小的图片,例如:"http://192.168.1.56:8087/Picture/testPic2.jpg?t=4"
具体参数值如下图:
参数值
|
图片大小(长*宽)
|
2
|
200*200
|
3
|
262*175
|
4
|
200*110
|
5
|
180*136
|
6
|
680*530
|
7
|
420*240
|
返回结果参数说明
名称
|
格式
|
说明
|
ResultCode
|
string
|
接口调用结果编码(详细)
|
ResultMessage
|
string
|
接口调用结果信息(详细)
|
名称
|
格式
|
说明
|
Id
|
string
|
视频ID
|
VideoTitle
|
string
|
视频标题
|
Description
|
string
|
视频描述
|
Tags
|
string
|
视频标签(不同标签之间用","隔开)
|
Actors
|
string
|
视频主演
|
Status
|
int
|
视频状态
|
CreateDate
|
DateTime
|
视频创建时间
|
CreateUser
|
string
|
视频上传用户名
|
PicSavePath
|
string
|
视频图片地址
|
名称
|
格式
|
说明
|
PlayURL
|
string
|
播放地址
|
MobilePlayURL
|
string
|
手机播放地址
|
DownloadURL
|
string
|
下载地址
|
名称
|
格式
|
说明
|
VideoURL
|
string
|
视频播放地址
|
Bitrate
|
string
|
视频比特率
|
BitrateLabel
|
string
|
视频比特率显示字段
|
调用代码实例
var appId = "jctv";
var appSecret = "123456";
var id = "13663557-d244-48a2-b84f-fa88f9a8c9fa";
var dateTime = Math.round(new Date().getTime() / 1000);
var Token = hex_md5(dateTime + appSecret);
var urltotal = "http://open.ksedu.cn/Api/Video?id=" + id+"&AppId="+appId+"&Timestamp=" + dateTime + "&Token="
+ Token;
$.ajax({
url: urltotal,
cache: false,
type: "GET",
dataType: 'json',
success: function (result) {
var showText = "ResultCode:" + result.AuthMsg.ResultCode + " \nResultMessage:" + result.AuthMsg.ResultMessage
+ "\nVideoModel:";
showText += "{\nId:" + result.VideoModel.Id + "\nVideoTitle:" + result.VideoModel.VideoTitle + "\nDescription:"
+ result.VideoModel.Description + "\nTags:" + result.VideoModel.Tags+"\nActors:"+result.VideoModel.Actors
+ "\nStatus:" + result.VideoModel.Status+"\nCreateDate:" + result.VideoModel.CreateDate + "\nPicSavePath:"
+ result.VideoModel.PicSavePath + "}\n";
showText +="\nMediaSever:{PlayURL:"+result.MediaSever.PlayURL+"\nMobilePlayURL:"+result.MediaSever.MobilePlayURL
+ "\nDownloadURL:"+ result.MediaSever.DownloadURL +"}";
showText += "\nVideoPlayFile:[";
if(result.videoplayfile){
for(var j=0;j<result.videoplayfile.length;j++){
showText +="{VideoURL:" +result.videoplayfile[j].VideoURL+" Bitrate:"+result.videoplayfile[j].Bitrate
+" BitrateLabel:"+result.videoplayfile[j].BitrateLabel+"}";
}
}
showText +="]" ;
alert(showText);
},
error: function (jqxhr, textstatus, errorthrown) {
alert(jqxhr.responsetext);
}
});
http请求
GET http://open.ksedu.cn/Api/Video/Get?id=02348139-a186-4137-aff7-bb29e5e2324b&AppId=jctv&Timestamp=1425438634&
Token=c19e8292880ee13f417a14f28fb12266 HTTP/1.1
Host: open.ksedu.cn
Connection: Keep-Alive
http应答
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/7.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 04 Mar 2015 03:03:08 GMT
Content-Length: 325
{"AuthMsg":{"ResultCode":"1","ResultMessage":"OK"},
"VideoModel":{"Id":02348139-a186-4137-aff7-bb29e5e2324b,"VideoTitle":"测试视频",
"Description":"测试描述","Tags":"测试标签","Actors":"测试演员",
"Status":1,"Duration":100,"CreateDate":"2015-01-01T10:13:30",
"PicSavePath":"http://192.168.1.56:8087/Picture/testPic.jpg",
"CreateUser":"zhangsan"},
"MediaSever":{"PlayURL":"http://192.168.1.106:10007/",
"MobilePlayURL":"http://192.168.1.106:10009/",
"DownloadURL":"http://192.168.1.106:10008/"},
"VideoPlayFile":[{"VideoURL":"20141125/five_800k.mp4",
"Bitrate":800,"BitrateLabel":"高清"},
{"VideoURL":"20141125/five_500k.mp4",
"Bitrate":500,"BitrateLabel":"标清"}]
}