分享到 :

分享视频到空间

  • 使用场景

用于分享视频到空间,走写说说路径

  • 接口方法

新增对象类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;
  • 参数说明
参数含义
assetURLALAsset的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) {
}];
返回顶部