1
I have an app to watch and download videos online, my code detects mimetype by the url to use as the video extension downloaded.
But some sites have the hidden extension, such as this url: http://www.animeplus.org/inc/video.inc.php?&file=NSwzOWE0YWQ5ODhhNWQ4NWEx&token=rm_uJeMTUxNjA4OTM0OQ==
Videoview can play the video, but Downloader takes mimetype as php and saves the video in the php extension, this is the code snippet I use to get the extension:
String mimeType = '.' + MimeTypeMap.getFileExtensionFromUrl(url.toString());
In this case he takes the video extension as he should: https://www.blogger.com/video-play.mp4?contentId=6bc99b4dd120f980
So how to solve this problem?
But this is java SE
– Samuel Ives
Java SE
is a development tool forJava Platform
. That’s justJava
(how is the question tag) and you can run the same code on Android.– Valdeir Psr
As I suspected, this is java SE, there must be other ways to do this on android.
– Samuel Ives
And there (after all this is Java), just copy the
try..catch
and execute this code with theAsyncTask
. '-'– Valdeir Psr
@Samuelives Java is Java, my fi.
– Jéf Bueno
java is java but there are different Ipps with different behaviors, android and j2me are both made in java but a code made for j2me will not run on android and vice and verça, as well as its code JAVA SE DESTINED TO DESKTOP AND NOT MOBILE, did not turn because it is not the target of the platform as I said before
– Samuel Ives
@Samuelives I made an example with Java WHICH ALSO SERVES ON ANDROID dude. Don’t you understand that? It can be negative without problems (black boot is like that). If you would like to read the documentation https://developer.android.com/reference/java/net/URL.html and https://developer.android.com/reference/java/HttpURLConnection.html you will see that the code I posted (part of it) also serves on Android. #ADSUMUS
– Valdeir Psr