使用 NSURLRequest 上传 Youtube 视频 [英] Youtube video upload using NSURLRequest

查看:18
本文介绍了使用 NSURLRequest 上传 Youtube 视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 NSURLRequest 将视频上传到 youtube.我能够进行身份验证并且用户和视频也被上传,当检查它时显示失败(无法转换视频文件)我不知道该怎么做,请使用

I am trying to upload the video to youtube using NSURLRequest. I am able to authenticate and the user and also video gets uploaded, and when checked it says Failed (unable to convert video file) i am not getting what to do, Please usggest

构造请求

Authorization = "Bearer ya29.AHES6ZTQ3rJZaf2g3pIYa_7_myg1N_GvQ4VdmJIcapfoqKIfQf-Iow";
Connection = close;
"Content-Length" = 1848078;
"Content-Type" = "multipart/related; boundary=217NH17UDP";
"GData-Version" = 2;
Host = "uploads.gdata.youtube.com";
Slug = "videoFile.mp4";
"X-GData-Key" = "key=AI39si4b-ta8ku-hbsLt73O0rIlOBjpHbITt8WGrwL7OevwjNjl5EFcowlJlBM6kp3rrU1cw64Vobp1l1lJP31Rqavshl4962A";

--217NH17UDP
Content-Type: application/atom+xml; charset=UTF-8

<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:media="http://search.yahoo.com/mrss/"
xmlns:yt="http://gdata.youtube.com/schemas/2007">
<media:group>
    <media:title type="plain">Sample Video File</media:title>
    <media:description type="plain">
        Description of the sample video
    </media:description>
    <media:category
        scheme="http://gdata.youtube.com/schemas/2007/categories.cat">Music
    </media:category>
    <media:keywords>Keywords</media:keywords>
</media:group>
</entry>
--217NH17UDP
Content-Type: video/mp4
Content-Transfer-Encoding: binary

Video data (NSData)

--217NH17UDP--

https://developers.google.com/youtube/2.0/中所述developer_guide_protocol_direct_uploading#Direct_uploading",

请推荐...

推荐答案

您可能希望将 content_type 设置为 video/*

You may wanna set content_type as video/*

这篇关于使用 NSURLRequest 上传 Youtube 视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆