简体   繁体   English

Google Drive SDK iOS-使用NSData(不是NSFileHandle)上传大视频ALAssetRepresentation吗?

[英]Google Drive SDK iOS - Upload LARGE video ALAssetRepresentation using NSData (not NSFileHandle)?

The example ... 这个例子 ...

https://code.google.com/p/google-api-objectivec-client/wiki/Introduction#Uploading_Files https://code.google.com/p/google-api-objectivec-client/wiki/Introduction#Uploading_Files

... uses NSFileHandle ... ...使用NSFileHandle ...

NSFileHandle *fileHandle = [NSFileHandle fileHandleForReadingAtPath:path];
if (fileHandle) {
  NSString *mimeType = @"image/jpeg";
  GTLUploadParameters *uploadParameters = [GTLUploadParameters uploadParametersWithFileHandle:fileHandle
                                                                                     MIMEType:mimeType];

... which means that you would need to (re)persist the ALAssetRepresentation to disk to be able to get a NSFileHandle, instead of just using ALAssetRepresentation getBytes:, and using NSData ... ...这意味着您需要将(ALAssetRepresentation)持久化到磁盘上才能获得NSFileHandle,而不是仅使用ALAssetRepresentation getBytes:和NSData ...

GTLUploadParameters *uploadParameters = [GTLUploadParameters uploadParametersWithData:uploadData
                                                                             MIMEType:fileObj.mimeType];

... is there a way to stream the ALAssetRepresentation NSData to the GTLServiceDrive query? ...是否可以将ALAssetRepresentation NSData流式传输到GTLServiceDrive查询?

Trying to ALAssetRepresentation getBytes: for a large video into memory causes a crash. 尝试ALAssetRepresentation getBytes:将大视频插入内存会导致崩溃。

Also, re(persisting) the ALAssetRepresentation to disk seems like waste - extra processing time & space (that may not exist). 另外,将(ALSssetRepresentation)重新(持久化​​)到磁盘似乎是浪费的-额外的处理时间和空间(可能不存在)。

Surely there is a nice way to do this with the Google Drive iOS SDK & direct ALAssetRepresentation streamed NSData? 当然,可以使用Google Drive iOS SDK和直接ALAssetRepresentation流NSData来实现此目的的好方法吗?

The DriveSDK only works with NSFileHandle, and from what I can tell there is no way to convert between an ALAssetRepresentation to a NSFileHandle except persisting to disk. DriveSDK仅与NSFileHandle一起使用,据我所知,除了持久存储到磁盘之外,没有办法在ALAssetRepresentation和NSFileHandle之间进行转换。 See this related Stack Overflow question . 请参阅此相关的堆栈溢出问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 iOS:如何使用Google Drive SDK库将数据(NSData)上传到特定的Google Drive文档(application / vnd.google-apps.document) - IOS: How to upload a data(NSData) to specific Google drive document(application/vnd.google-apps.document) using Google drive sdk library 使用Google Drive iOS SDK分段上传 - Multipart Upload using Google Drive iOS sdk IOS:如何使用Google驱动器sdk库将文件上传到特定的Google云端硬盘文件夹 - IOS: How to upload a file to specific Google drive folder using Google drive sdk library 使用iOS sdk将文件上传到Google云端硬盘 - Uploading a file to Google drive using iOS sdk iOS中的Google Drive SDK - Google Drive SDK in iOS Google Drive Sdk- iOS应用程序中的音频和视频流 - Google Drive Sdk- Audio & Video Streaming in iOS Application iOS - 流式传输大文件以供上传(使用 NSData 分配过大文件时应用程序崩溃) - iOS - Streaming large files for upload (application crashes when allocating too large files using NSData) 如何使用Facebook iOS SDK 4.0 FBSDKShareDialog分享NSData或phasset视频 - How to share NSData or phasset video using Facebook iOS SDK 4.0 FBSDKShareDialog Google Drive SDK和iOS 5.1 - Google Drive SDK and iOS 5.1 iOS:NSFileHandle与NSOutputStream进行大文件下载 - iOS: NSFileHandle vs NSOutputStream for large file download
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM