Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Drive Sdk- Audio & Video Streaming in iOS Application

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...

like image 232
NextStep Avatar asked Sep 19 '13 11:09

NextStep


3 Answers

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

like image 70
Nitesh Avatar answered Oct 06 '22 00:10

Nitesh


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.

like image 25
pinoyyid Avatar answered Oct 05 '22 23:10

pinoyyid


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

like image 27
Burcu Dogan Avatar answered Oct 05 '22 23:10

Burcu Dogan