1
votes

I have developed an android app using which one can upload,download,create files on Google Drive.Now I want to play audio files (not after downloading but streaming )which are on Google Drive in custom music player. For playing audio files I'm using link provided in music file response such as

musicFile.getSelfLink()
musicFile.getAlternateLink()
musicFile.getSelfLink()
musicFile.getDefaultOpenWithLink()
musicFile.getWebContentLink()

I tried all links provided in response.But could not play music file.It gave me errors like

Couldn't open file on client side, trying server side or media player error

Please help me.Am I missing something? Thanks in advance.

2

2 Answers

3
votes

Authorize the file.getDownloadLink() with your user's access token. You should be able to stream it.

3
votes

When you need to play your private files, you need next link:

String link = file.getDownloadUrl() + "&access_token=" + yourToken + "&alt=media";

It works for me in REST API v2