[英]stream audio files to play from google drive using google drive api in android
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. 我开发了一个Android应用程序,可以在Google Drive上上传,下载,创建文件。现在,我想播放自定义音乐播放器中Google Drive上的音频文件(不是下载后而是流式播放)。 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. 提前致谢。
Authorize the file.getDownloadLink()
with your user's access token. 使用用户的访问令牌对file.getDownloadLink()
进行授权。 You should be able to stream it. 您应该能够流式传输它。
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 在REST API v2中对我有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.