public string UpVideoToken(string filename) { string code = StringUtils.urlSafeBase64Encode("4115220123456789"); string tsname = StringUtils.urlSafeBase64Encode(filename + "$(count)"); string saveas_key = StringUtils.urlSafeBase64Encode(bucketvideo + ":" + filename); string hlsKeyUrl = StringUtils.urlSafeBase64Encode("http://www.xueqitian.com/Help/CourseVideo"); string fops = "avthumb/m3u8/noDomain/1/vb/320k/s/1280x720/segtime/30/ab/192k/stripmeta/0/ar/22050/acodec/libfaac/r/5/hlsKey/" + code + "/hlsKeyUrl/" + hlsKeyUrl + "/pattern/" + tsname + "|saveas/" + saveas_key;//+ "/pattern/" + tsname // 上传策略 Qiniu.Common.Config.ZONE = Qiniu.Common.Zone.ZONE_CN_South(); PutPolicy putPolicy = new PutPolicy(); //putPolicy.PersistentOps = // 设置要上传的目标空间 putPolicy.Scope = bucketvideo + ":" + filename; // 上传策略的过期时间(单位:秒) putPolicy.SetExpires(3600); putPolicy.PersistentOps = fops; putPolicy.PersistentPipeline = "xqtvedio"; //return putPolicy.Scope; Mac mac = new Mac(AK, SK); // Use AK & SK here // 生成上传凭证 string uploadToken = Auth.createUploadToken(putPolicy, mac); mytoken token1 = new mytoken(); token1.uptoken = uploadToken; uploadToken = JsonConvert.SerializeObject(token1); return(uploadToken); }
//供给七牛上传组件调用 // GET: Help public string UpToken(string filename) { // 上传策略 PutPolicy putPolicy = new PutPolicy(); // 设置要上传的目标空间 putPolicy.Scope = bucket2 + ":" + filename; // 上传策略的过期时间(单位:秒) putPolicy.SetExpires(3600); //return putPolicy.Scope; Mac mac = new Mac(AK, SK); // Use AK & SK here // 生成上传凭证 string uploadToken = Auth.createUploadToken(putPolicy, mac); mytoken token1 = new mytoken(); token1.uptoken = uploadToken; uploadToken = JsonConvert.SerializeObject(token1); return(uploadToken); }