Hello,
I got the below exception for the video URL,
https://drive.google.com/uc?export=open&id=1NJnSHcUYBY3EDs23Yn2dWSVLUxm1Wzeh
Exception,
com.google.android.exoplayer2.ExoPlaybackException: com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (MatroskaExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, Ac3Extractor, TsExtractor, FlvExtractor, OggExtractor, PsExtractor, WavExtractor, AmrExtractor, Ac4Extractor, FlacExtractor) could read the stream.
I wondered if you used ExoPlayer to play the link you posted? Because when you use that link, ExoPlayer will essentially try to "play" the Google drive landing page.
I wondered if you used ExoPlayer to play the link you posted? Because when you use that link, ExoPlayer will essentially try to "play" the Google drive landing page.
Actually, We have a requirement from our client, that is they are uploading videos on google drive and they need to play in the Android app
We are making google drive video URL streamable before playing it on Exo player,
below is another google drive sample link and that is playing,
https://drive.google.com/uc?export=open&id=16-9PgLbLq6jzjSWyoQsEh8FLzg6KuNu-
below is my code to make drive/dropbox video url streamable,
when {
driveLink.contains("dropbox.com") ||
driveLink.endsWith("?dl=0") -> driveLink.replace("dl=0", "raw=1")
driveLink.contains("google.com") -> {
var driveUrl = ""
val driveUrlArray = driveLink.split("file/d/")
when {
driveUrlArray.size > 1 -> {
driveUrl = driveUrlArray[0] + "uc?export=open&id=" + driveUrlArray[1].split("/")[0]
driveUrl
}
else -> driveLink
}
}
else -> driveLink
}
the only problem is with the given URL.
If you are modifying the Google Drive link so that it is directly downloadable, and one of your links worked, I think you should first try the following:
Transform the link you posted, and try loading that in a browser. If the browser shows a video playing, then you know the link is OK, and ExoPlayer is doing something weird. Else, it would be the problem of the link.
I think the problem is that your "making the URL streamable" logic doesn't give you a direct URL to the media. It gives you a URL that Google Drive might resolve to the media, or not, depending on its own logic and implementation. For your "working" link Google Drive seems to resolve the URL you're constructing to the media. For your "broken" link it's resolving to a web page that warns you the file is too large to scan for viruses. So it seems that your way of "making the URL streamable" doesn't work for large files. As @lcf87 notes, you can see this behaviour by trying to load the two links in a web browser.
I think we can close this because ExoPlayer is (correctly) failing to play back the web page. I'm not sure Google Drive is really designed to support direct streaming of media, but in any case, acquiring the correct link to the media is outside the scope of this issue tracker.