5
votes

Hi Google Drive Staff,

I have tried to stream video files from Google Drive(Without Downloading). But I gets alerts that Sign In. I have went thoroughly with Dr. Edit sample App but i did not found any solution. I tried with downloadUrl , embedLink, webContentLink, alternateLink. All gives message to sign In. When i tried with exportsLinks i get a Null Message. What is the problem Here. If U have any suggestion Please Let me Know...

I have tried with Google Drive for iOS in iPod, there we can stream Video without Downloading. Please suggest me to resolve this issue

Thanks in Advance...

3

3 Answers

5
votes

I could solve it just by appending the access_token to the download url

audiofile.strPath=[NSString stringWithFormat@"%@&access_token=%@",downloadUrl,accessToken];   

pass the strPath to your avplayer object to play music.

I did not try the video part. but i think a similar approach should work.

you can fetch the access token from the GTMOAuth2Authentication object

Note that you might need to refresh it if its expires.

Hope this helps you.

Regards Nitesh

1
votes

I think it depends what you mean by "stream". Last time I looked, the download links all had a content disposition: attachment header, which instructs the browser to download rather than render the content.

If you have your own client fetching the url, you can choose to ignore that header and do what you like with the content as it is fetched. imho, it would be nice if the client could add a parameter to the url to indicate to the Google servers that it wants the content to be rendered v. downloaded, but hey ho.

1
votes

You need to authorize all requests to downloadLinks with an Authorization header. Read more about the authorization and learn how to retrieve your users an access token on https://developers.google.com/drive/about-auth