Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
781 views
in Technique[技术] by (71.8m points)

ios - Youtube video upload using NSURLRequest

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

constructed request

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--

as specified in "https://developers.google.com/youtube/2.0/developers_guide_protocol_direct_uploading#Direct_uploading",

Please suggest...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You may wanna set content_type as video/*


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...