使用Youtube Data API V3设置和取消设置水印请求时出错

时间:2014-12-12 04:50:56

标签: c# youtube-api youtube-data-api google-api-dotnet-client

我正在使用

        IDE       :     VS2012  
        Framework :     4.0
        Google API:     Youtube Data V3
        Authentication: Outh 2.0

我正在使用 Youtube Data API V3 在youtube视频上设置水印。这是我的代码

**my fiddler request**是:POST https://www.googleapis.com/youtube/v3/watermarks/set?channelId=UCyAn2aVZWNAugdlckOJKG5A

和我的内容正文:     {      "职位":{       " cornerPosition":" topRight",       "输入":"角落"      },      "计时":{       " durationMs":" 50000",       " offsetMs":" 1000",       "输入":" offsetFromStart"      },      " targetChannelId":" UCyAn2aVZWNAugdlckOJKG5A"     }

我使用set方法传递带有流对象的图像内容..

响应值不能为null参数名称:baseUri

public async Task setwatermark()
        {

        InvideoBranding ib = new InvideoBranding();
        InvideoTiming it = new InvideoTiming();
        InvideoPosition ip = new InvideoPosition();
        Stream stream = null; 
        it.Type = "offsetFromStart";
        it.OffsetMs = 1000;
        it.DurationMs = 50000;

        ip.Type = "corner";
        ip.CornerPosition = "topRight";

        string filepath = Server.MapPath("~/Images/orderedList0.png");
        ib.TargetChannelId = "UCyAn2aVZWNAugdlckOJKG5A";
     //   ib.ImageUrl = filepath;
        ib.Position = ip;
        ib.Timing = it;


        using (var fileStream = new FileStream(filepath, FileMode.Open))
        {
            stream = (Stream)fileStream;
            var setrequest = youtubeService.Watermarks.Set(ib, "UCyAn2aVZWNAugdlckOJKG5A",stream,"image/*");
            var resp =await setrequest.UploadAsync();


        }

以下代码适用于使用YouTube Data API V3的未设置水印。 响应时出现--Error 503-backend error。

提琴请求:POST https://www.googleapis.com/youtube/v3/watermarks/unset?channelId=UCyAn2aVZWNAugdlckOJKG5A

    **Fiddler response**  :{
     "error": {
      "errors": [
       {
        "domain": "global",
        "reason": "back end Error",
        "message": "Back end Error"
       }

  ],
  "code": 503,
  "message": "Back end Error"
 }

}

 private void Unsetwatermark()
        {


        var unsetrequest = youtubeService.Watermarks.Unset("UCyAn2aVZWNAugdlckOJKG5A");

        var searchListResponse = unsetrequest.Execute();





    }

请告诉我上面提到的api请求我做错了什么..

0 个答案:

没有答案