
| 名称 | 格式 | 是否可空 | 说明 |
|---|---|---|---|
| appId | String | 否 | 该系统在开放平台中的ID |
| timestamp | String | 否 | 时间参数。时间验证与服务器时间误差不得超过10分钟(600秒),以北京时间为准。 获取方法:C#: long nowTime = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000 例:1369898793 Javascript: Math.round(new Date().getTime() / 1000) |
| token | String | 否 | 指timestamp+appSecret 在进行MD5加密后的字符串(转换后字母都为小写),appSecret为该系统在校园电视网中的密钥) 例如: timestamp为1370585811,appSecret为0123456789,加密前的字符串:13705858110123456789,加密后的字符串:c0c5ad4975c735e1c856d6a6b5d4310b |
| uia_username | String | 否 | UIA统一身份认证用户名 |
| local_username | String | 否 | 第三方对接系统的用户名(如果第三方系统用户名和UIA统一身份认证用户名一致,请使用UIA统一身份认证用户名) |
| 名称 | 说明 |
|---|---|
| onSuccess | 上传完视频文件成功后执行的事件 |
| onFailure | 上传视频文件发生错误时执行的事件 |
| onError | 网络出现问题的时候执行的事件 |

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<title>上传视频</title>
<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script src="~/Scripts/md5.js"></script>
<script src="http://open.tv.nje.cn/Scripts/JKScripts/initUploadSelectVideoAlert.js" type="text/javascript"></script>
<script type="text/javascript">
function winopen() {
var appId = $("#AppId").val();
var appSecret = $("#AppSecret").val();
var t = Math.round(new Date().getTime() / 1000); //声明一个时间
var token = hex_md5(t + appSecret);//声明一个上传令牌。
jkUploadAlertBox.openUpload({
//应用ID,由视频开放平台提供
appId: appId,
//视频ID
videoId: $("#videoId").val(),
//时间戳
timestamp: t,
//令牌
token: token,
//距窗口左边的距离
left: "20px",
//距窗口上边的距离
top: "20px",
//是否覆盖整个浏览器,true:覆盖整个浏览器; false:覆盖局部区域(如果弹出层在iframe内部,
//则只覆盖iframe区域,其他情况同true)
isTop:true,
//对接的UIA用户名
uia_username: "uia_username",
//本系统用户名(第三方系统)
local_username: "local_username",
//上传完视频文件后执行的事件
onSuccess: function (data) { alert("视频上传成功,视频ID="+data.VideoID); },
//上传视频文件出现错误发生的事件
onFailure: function () { alert("未上传视频或视频上传失败"); },
//网络出现问题的时候触发的事件
onError: function () { alert("error"); }
});
}
</script>
</head>
<body>
<h1>上传视频文件:</h1>
<div>
<div>
<span class="itemNametop">AppId:</span> <input type="text" id="AppId"
value="f6f46cc8-02d3-44e8-bdf1-bfc87b6a3f39" /></div>
<div>
<span class="itemNametop">AppSecret:</span><input type="text" id="AppSecret"
value="e7f46cc8-02d3-44e8-bdf1-bfc87b6a3f39" /></div>
<div>
<span class="itemNametop">videoId:</span><input type="text" id="videoId"
value="000c1743-08b9-4584-b20c-75fe017b35ab" /></div>
</div>
<div>
<input type="button" onclick="winopen()" style="width: 80px;" value="上传" />
</div>
</html>
| 名称 | 格式 | 是否可空 | 说明 |
|---|---|---|---|
| AppId | String | 否 | 该系统在开放平台中的ID |
| Timestamp | String | 否 |
时间参数,验证条件是当前时间与服务器时间误差不得超过10分钟(600秒),以北京时间为准。例如值为:1369898793;
获取方法如下: C#: (DateTime.Now.ToUniversalTime().Ticks-621355968000000000) /10000000; Javascript:Math.round(new Date().getTime() /1000); |
| Token | String | 否 | 令牌,取值方法为:Timestamp + AppSecret在进行MD5加密后的字符串(转换后字母都为小写),AppSecret为该系统在开放平台中的密钥) |
| VideoInfo | PutVideoModel | 否 | 视频信息 |
| 名称 | 格式 | 是否可空 | 说明 |
|---|---|---|---|
| Id | String | 否 | 视频Id |
| VideoTitle | String | 否 | 视频标题(最大长度为50字符,大于50字符只截取前50位) |
| Description | String | 是 | 视频描述(最大长度为400字符,大于400字符只截取前400位) |
| Tags | String | 是 | 视频标签(最大支持五个标签,标签之间用","隔开,最大长度为60字符,大于60字符只截取前60位) |
| Actors | String | 是 | 视频主演(最大长度为50字符,大于50字符只截取前50位) |
{
"ResultCode":"1",
"ResultMessage":"OK"
}
POST http://localhost:8090/Api/Video/Put HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: localhost:8090
Content-Length: 320
Connection: Keep-Alive
AppId=jctv&Timestamp=1425469528&Token=27eb325be82f4384a9d11063105b8891&VideoTitle=%E6%9B%B4%E6%96%B0%E8%A7%86%E9%A2%91
&Description=%E6%96%B0%E8%A7%86%E9%A2%91%E6%8F%8F%E8%BF%B0&Tags=%E6%96%B0%E8%A7%86%E9%A2%91%E6%A0%87%E7%AD%BE
&Actors=%E6%96%B0%E8%A7%86%E9%A2%91%E6%BC%94%E5%91%98&Id=9deb4b69-bb31-48f5-a303-98370b57b946
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 11:37:51 GMT
Content-Length: 39
{"ResultCode":"1","ResultMessage":"OK"}
public ActionResult PostMethodWebAPI(string videoTitle, string description, string tags, string actors,
int sourceFileGetType, string sourceFilePath, string appId, string appSecret)
{
//请求地址
string url = "http://open.tv.nje.cn/Api/Video/Post";
//请求参数
Dictionary<, string> parameters = new Dictionary<string, string >();
//应用ID
parameters.Add("AppId", appId);
long dateTime = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000;
string token = MD5.HashUTF8(dateTime + appSecret);
//时间戳
parameters.Add("Timestamp", dateTime.ToString());
//令牌
parameters.Add("Token", token);
//视频标题
parameters.Add("VideoTitle", videoTitle);
//视频描述
parameters.Add("Description", description);
//视频标签
parameters.Add("Tags", tags);
//视频主演
parameters.Add("Actors", actors);
//视频上传用户名
parameters.Add("CreateUser", createUser);
//视频上传方式(这里应该为2)
parameters.Add("SourceFileGetType", sourceFileGetType.ToString());
//视频源地址(这里不能为空)
parameters.Add("SourceFilePath", sourceFilePath);
//请求方法
RequestMethod method = RequestMethod.Post;
//web请求(OAuth自定义库)
string result = OAuth.OAuth.Request(url, parameters, method);
return this.Json(new { result = result }, JsonRequestBehavior.AllowGet);
}
| 名称 | 说明 |
|---|---|
| VideoId | 视频Id |
| VideoStatus | 视频状态 |
| 视频状态 | 说明 |
|---|---|
| 0 | 等待删除 |
| 1 | 正常 |
| 2 | 等待下载 |
| 3 | 正在下载 |
| 4 | 下载失败 |
| 5 | 等待转码 |
| 6 | 正在转码 |
| 7 | 转码失败 |
| 8 | 未上传视频文件 |