传递ChromeCast Google云端硬盘媒体文件

时间:2015-09-15 12:08:41

标签: android ios google-drive-api chromecast google-cast

如何将ChromeCast传递给Google云端硬盘文件

根据Drive Docs https://developers.google.com/drive/web/manage-downloads

GET https://www.googleapis.com/drive/v2/files/<myFileID>?alt=media
Authorization: Bearer ya29.AHESVbXTUv5mHMo3RYfmS1YJonjzzdTOFZwvyOAUVhrs

然而,Chromecast的初始化程序不允许我传递标题。

* @param contentID The content ID.
* @param streamType The stream type.
* @param contentType The content (MIME) type.
* @param metadata The media item metadata.
* @param streamDuration The stream duration.
* @param mediaTracks The media tracks, if any, otherwise <code>nil</code>.
* @param textTrackStyle The text track style, if any, otherwise <code>nil</code>.
* @param customData The custom application-specific data.
*/
- (instancetype)initWithContentID:(NSString *)contentID
                       streamType:(GCKMediaStreamType)streamType
                      contentType:(NSString *)contentType
                         metadata:(GCKMediaMetadata *)metadata
                   streamDuration:(NSTimeInterval)streamDuration
                      mediaTracks:(NSArray *)mediaTracks
                   textTrackStyle:(GCKMediaTextTrackStyle *)textTrackStyle
                       customData:(id)customData;

我已尝试将刷新令牌传递为&amp; access_token =%@但它似乎不接受Google云端硬盘

1 个答案:

答案 0 :(得分:0)

我设法使用 GTLDriveFile.downloadUrl 访问令牌,但未使用 alt =媒体 下载格式

我将&amp; access_token =“ya29.fffff”添加到downloadURL,而不是刷新令牌。

获取访问令牌非常简单,因为Google Api会对其进行模糊处理,但这是不同的问题

这是ChromeCast接受的网址

url:https://doc-0o-8s-docs.googleusercontent.com/docs/securesc/6jbbjm36tl2vvbnepiqedkpbkuhg3r98/v71obao5sam6d833fitiouc32bvcrkmg/1442390400000/00092883636123010676/00092883636123010676/0B-X-qhbL0RO4SWl5V3Y2VjFsZlE?e=download&gd=true&access_token=ya29.8AGXvMuvxRa9X3xLLUZdJTqMS_rHRstXMLgmBhMY_90ti4hC50540y4G-qOutfbDpO