F fasilosman Active Member Licensed User Longtime User Jul 17, 2021 #1 Hi all, I tried to load a video from google drive using Exoplayer. I got an error as.. Error: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 400 Click to expand... This is my sample code.. B4X: Copy player1.Initialize("player") player1.Prepare(player1.CreateUriSource("https://www.googleapis.com/drive/v3/files/XXXXXXXXXXXXX/?key=XXXXXXXX&alt=media")) SimpleExoPlayerView1.Player = player1 player1.Play But when I tried this link in a web browser, the MP4 file is downloaded. Can anyone let me know the issue. Thank you
Hi all, I tried to load a video from google drive using Exoplayer. I got an error as.. Error: com.google.android.exoplayer2.upstream.HttpDataSource$InvalidResponseCodeException: Response code: 400 Click to expand... This is my sample code.. B4X: Copy player1.Initialize("player") player1.Prepare(player1.CreateUriSource("https://www.googleapis.com/drive/v3/files/XXXXXXXXXXXXX/?key=XXXXXXXX&alt=media")) SimpleExoPlayerView1.Player = player1 player1.Play But when I tried this link in a web browser, the MP4 file is downloaded. Can anyone let me know the issue. Thank you
drgottjr Expert Licensed User Longtime User Jul 18, 2021 #2 you need the actual id of the file. the url you show is precisely for downloading. take a look at this i think it's going to be very tricky (if possible) to obtain that id from within your app and then pass it to exoplayer. we went through several iterations of a similar situation regarding the real location of youtube videos. every time someone figured out how to parse the url, google would change it. you could conceivably get the id directly with your browser on a pc and use it with exoplayer to play the same video (or a small list of videos) over and over. but if you're thinking of storing videos on drive and "streaming" them in your app with exoplayer, it's going to be very inconvenient without a pre-built list of id's that you've managed to obtain and store in your app as a play list. that may, in fact, be exactly what you want... Upvote 0
you need the actual id of the file. the url you show is precisely for downloading. take a look at this i think it's going to be very tricky (if possible) to obtain that id from within your app and then pass it to exoplayer. we went through several iterations of a similar situation regarding the real location of youtube videos. every time someone figured out how to parse the url, google would change it. you could conceivably get the id directly with your browser on a pc and use it with exoplayer to play the same video (or a small list of videos) over and over. but if you're thinking of storing videos on drive and "streaming" them in your app with exoplayer, it's going to be very inconvenient without a pre-built list of id's that you've managed to obtain and store in your app as a play list. that may, in fact, be exactly what you want...
MarcoRome Expert Licensed User Longtime User Jul 18, 2021 #3 Look [B4X] Direct Link Google Drive Hi All. For example, if you need to view a movie in exoplayer and the movie is on Google Drive, you can switch the Direct Link of Google Drive to Exoplayer ("uri"). Original link Example code: Dim link_drive As String =... www.b4x.com Click to expand... Upvote 0
Look [B4X] Direct Link Google Drive Hi All. For example, if you need to view a movie in exoplayer and the movie is on Google Drive, you can switch the Direct Link of Google Drive to Exoplayer ("uri"). Original link Example code: Dim link_drive As String =... www.b4x.com Click to expand...
F fasilosman Active Member Licensed User Longtime User Jul 19, 2021 #4 MarcoRome said: Look Click to expand... Thank you. I tried. It worked. But it allows only once or twice. Then it say "user cannot download" or "download limit exceeded" or " owner and editor can download". Then I changed sharing permission to all file to "editor" not "viewer". Now its working fine. Now I another problem. I will ask it in a new post. Thank you all for helping me. Upvote 0
MarcoRome said: Look Click to expand... Thank you. I tried. It worked. But it allows only once or twice. Then it say "user cannot download" or "download limit exceeded" or " owner and editor can download". Then I changed sharing permission to all file to "editor" not "viewer". Now its working fine. Now I another problem. I will ask it in a new post. Thank you all for helping me.
F fasilosman Active Member Licensed User Longtime User Jul 19, 2021 #5 Now. After I play several videos, it is not working. I tested the link with the browser and it says We're sorry... ... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now. See Google Help for more information. Click to expand... Now I like to try it with "One drive". lets see, will it work. Upvote 0
Now. After I play several videos, it is not working. I tested the link with the browser and it says We're sorry... ... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now. See Google Help for more information. Click to expand... Now I like to try it with "One drive". lets see, will it work.