分享视频到空间
- 使用场景
用于分享视频到空间,走写说说路径
- 接口方法
新增对象类QQApiVideoForQZoneObject
- (id)initWithAssetURL:(NSString*)assetURL title:(NSString*)title extMap:(NSDictionary *)extMap; - (id)initWithVideoData:(NSData*)videoData title:(NSString*)title extMap:(NSDictionary *)extMap; |
+ (id)objectWithAssetURL:(NSString*)assetURL title:(NSString*)title extMap:(NSDictionary *)extMap; + (id)objectWithVideoData:(NSData*)videoData title:(NSString*)title extMap:(NSDictionary *)extMap; |
- 参数说明
参数 | 含义 |
assetURL | ALAsset的ALAssetPropertyAssetURL,或者PHAsset的localIdentifier |
extMap | 扩展字段 |
videoData | 视频数据,大小不超过50M |
- 示例代码
ALAssetsLibrary * assetLibrary = [[ALAssetsLibrary alloc] init]; [assetLibrary assetForURL:_videoAssetForQZone resultBlock:^(ALAsset *asset) { ALAssetRepresentation* representation = [asset defaultRepresentation]; uint8_t* buffer = (uint8_t*)malloc(representation.size); [representation getBytes:buffer fromOffset:0 length:representation.size error:nil]; NSData* data = [NSData dataWithBytesNoCopy:buffer length:representation.size freeWhenDone:YES]; QQApiVideoForQZoneObject *video = [QQApiVideoForQZoneObject objectWithVideoData:data title:text extMap:dict]; video.shareDestType = [self getShareType]; SendMessageToQQReq *req = [SendMessageToQQReq reqWithContent:video]; QQApiSendResultCode sent = [QQApiInterface SendReqToQZone:req]; [self handleSendResult:sent]; } failureBlock:^(NSError *error) { }]; |