优酷接口的使用

/**
*检测标签
*/
function checkTags(){
//显示数据
$(“#tags_error_span”).hide();
$(“#tags_right_span”).hide();
var tags = $(“#input02”).val();
//判断用户名是否为空
if(tags == “” || tags == null){
$(“#tags_right_span”).hide();
$(“#tags_error_span”).show();
}else if(tags.length < 2){
$(“#tags_right_span”).hide();
$(“#tags_error_span”).show();
$(“#tags_error_text”).text(“标签不能少于两个字符”);
}else{
$(“#tags_error_span”).hide();
$(“#tags_right_span”).show();
}
}
/**
* 检查简介
*/
function checkDric(){
//显示数据
$(“#description_error_span”).hide();
$(“#description_right_span”).hide();

var content = $(“#textarea”).val().toString();

var len = 0;
if (content != null && content != “”) {
for ( var j = 0; j < content.length; j++) {
var str = content.charAt(j);
var reg = /^[\u4E00-\u9FA5]+$/;
if (reg.test(str)) {
len += 2;
} else {
len += 1;
}
}
}

if(content == “” || len == 0 ){
$(“#description_right_span”).hide();
$(“#description_error_text”).text(“请输入简介”);
$(“#description_error_span”).show();
$(“#btn-upload-start”).attr(“disabled”,”disabled”);
}

if(len <= 25 && len >0){
$(“#description_error_span”).hide();
$(“#description_right_span”).show();
$(“#btn-upload-start”).attr(“disabled”,false);
}else{
$(“#description_right_span”).hide();
$(“#description_error_span”).show();
$(“#btn-upload-start”).attr(“disabled”,”disabled”);
}

}

</script>
</head>
<body onload=”getJobSooId();”>
<!– 头部 –>
<jsp:include page=”../../public/header.jsp”></jsp:include>
<div id=”youku-upload”>
<div class=”container”>
<form  class=”well form-horizontal”  name=”video-upload”>
<fieldset><div class=”control-group”>
<label class=”control-label” for=”spanSWFUploadButton”>选择文件:</label>
<div id=”uploadControl” class=”controls”>

</div>
</div>
<div class=”control-group”>
<label class=”control-label” for=”input01″>标题:</label>
<div class=”controls”>
<input type=”text” class=”input-xlarge” id=”input01″ name=”title” onblur=”checkTitle()”>
<span id=”title_error_span” style=”display:none”>
<img src=”images/error02.gif” width=”17″ height=”17″ alt=”” />
&nbsp;<span id=”title_error_text”>请输入标题</span>
</span>
<span id=”title_right_span” style=”display:none”>
<img src=”images/right.gif” width=”17″ height=”17″ alt=””/>
&nbsp;<span>标题可用</span>
</span>

</div>
</div>
<div class=”control-group”>
<label class=”control-label” for=”textarea”>简介:</label>
<div class=”controls”>
<textarea class=”input-xlarge” id=”textarea” rows=”3″ name=”description” onkeyup=”checkDric()”></textarea>
<span id=”description_error_span” style=”display:none”>
<img src=”images/error02.gif” width=”17″ height=”17″ alt=”” />
&nbsp;<span id=”description_error_text”>简介过长</span>
</span>
<span id=”description_right_span” style=”display:none”>
<img src=”images/right.gif” width=”17″ height=”17″ alt=””/>
&nbsp;<span>简介可用</span>
</span>
</div>
</div>
<div class=”control-group”>
<label class=”control-label” for=”input02″>标签:</label>
<div class=”controls”>
<input type=”text” class=”input-xlarge” id=”input02″ name=”tags” onblur=”checkTags()”>
<span class=”help-inline”></span>
<span id=”tags_error_span” style=”display:none”>
<img src=”images/error02.gif” width=”17″ height=”17″ alt=”” />
&nbsp;<span id=”tags_error_text”>请输入标签</span>
</span>
<span id=”tags_right_span” style=”display:none”>
<img src=”images/right.gif” width=”17″ height=”17″ alt=””/>
&nbsp;<span>标签可用</span>
</span>
</div>
</div>
<div class=”control-group”>
<label class=”control-label” for=”category-node”>类别:</label>
<div class=”controls”>
<select id=”category-node” name=”category” ></select>
</div>
</div>
<div class=”control-group”>
<label class=”control-label”>版权所有</label>
<div class=”controls”>
<label class=”radio inline”>
<input type=”radio” name=”copyright_type” id=”copyright_type2″ value=”original” checked=””>原创</label>
<label class=”radio inline”><input type=”radio” name=”copyright_type” id=”copyright_type1″ value=”reproduced”>转载</label>
</div>
</div>
<div class=”control-group”>
<label class=”control-label”>视频权限</label>
<div class=”controls”>
<label class=”radio inline”>
<input type=”radio” name=”public_type” id=”public_type1″ value=”all” checked=””>公开
</label>
<label class=”radio inline”>
<input type=”radio” name=”public_type” id=”public_type2″ value=”friend”>仅好友
</label>
<label class=”radio inline”>
<input type=”radio” name=”public_type” id=”public_type3″ value=”password”>输入密码观看
</label>
<label class=”radio inline” style=”display:none” id=”passwrod”>
<input type=”text” class=”input “name=”watch_password”>
</label>
</div>
</div>
<div class=”form-actions”>
<button type=”button” class=”btn btn-primary start”  id=”btn-upload-start” >
<i class=”icon-upload icon-white”></i>
<span>开始上传</span>
</button>
</div>
</fieldset>
</form>
<div class=”row” >
<div class=”span5″ id=”upload-status-wraper” ></div>
</div>
<div class=”well”><h3>说明</h3><ul><li>最大支持上传<strong>1 GB</strong> 视频文件</li><li>
允许上传的视频格式为:wmv,avi,dat,asf,rm,rmvb,ram,mpg,mpeg,3gp,mov,mp4,m4v,dvix,dv,dat,
</br>
mkv,flv,vob,ram,qt,divx,cpk,fli,flc,mod。不符合格式的视频将会被丢弃,请确保视频格式的正确性,避免上传失败
</li></ul>
</div>
</div>
<div id=”complete”></div>
<div id=”login” style=”width:100%;height:100%;position:fixed;z-index:999;left:0px;top:0px;overflow:hidden;display:none;”>
</div>
<!– 尾部 –>
<jsp:include page=”../../public/footer.jsp”></jsp:include>
<style>
.container, .navbar-static-top .container, .navbar-fixed-top .container, .navbar-fixed-bottom .container{ width:1040px; margin:0 auto;}
.form-horizontal{ padding-left:100px; margin:0 auto 20px; overflow:hidden; clear:both;}
.form-actions { width:620px; margin:0 auto;}
</style>
</body>
</html>

2、从优酷上获取所上传视频的状态,以及删除视频,播放视频

由于在ie游览器中优酷返回的json时,ie直接提示下载而不是返回到ajax的success中的data的情况,所有借组httpCilent模拟请求

发表评论

电子邮件地址不会被公开。 必填项已用*标注