Uploading video or audio to firebase using kotlin - android

I am trying to upload a record, an audio, from my local storage (immediately after instructing the app to stop recording) it is a voice to speech app, I get it to start recording and it stops after a period of 1min as I had programmed it, I try to get the record using the path which I had written it to but I just don't know how to go about it, even more I have been searching youtube, I see more of uploading images to firebase firestore using kotlin, please I need to upload a video or audio file using kotlin.

Related

Android Exoplayer caching m3u8 audio for offline support

I am creating a music application.
I have used Exoplayer V2.8.0, So far I have achieved to play, pause next, prev, shuffle, repeat all songs using controls in-app and also with notification.
But all of this works only in online mode.
Now I want to add offline support to this app and allow a user to download the song offline and play while they are offline.
Audio files we are getting are *.m3u8 files.
But my problem is user should not access those downloaded files outside of my app. I have tried using one approach but it gives the mp3 files downloaded and combined from the different segments of the m3u8 file.
Can anyone guide me or give me sample or tutorial on how can I download the segments only and at the time of playing I can use that segment and play audio offline?
There is one suggestion for you,
If you want to create an offline player with .m3u8 or any other file then after download saves your file into your package folder with some of the different formats. Then while using that convert that specific formatted to mp3 or other which will help out for offline music play.
You can use a local http proxy server (NanoHttpd). Start the server and point your ExoPlayer to 127.0.0.1 so you can monitor the requests. Cache the m3u8 playlist plus the downloaded files for the first time you see a request. Next time when your proxy detects the same request, just play the files from cache.

Firebase Storage: Play back of a video url directly?

I have been searching a lot about this by now and I got nothing:
I am trying to play a video from firebase storage and trying to be able to see its progress on the player as it loads and to be able to seek it backward and forward (stuff that any player does while streaming a video).
The problem:
Firebase team say that it is not possible to stream a video from the cloud storage (it is not supported).
Eventhough I was able to do this:
String url = "my_url_at_firebase_storage";
video_View.setVideoUri(Uri.parse(url));
video_View.start();
and I was able to load the video from firebase storage into a video view.
I checked:
I checked this link that has an answer that says you have to transcode the video to chunks and save the chuncks to firebase storage and then load them:
But I am lost here:
1) What are chunks of video?
2) How would you stream these chunks if firebase doesn't support streaming?
My question:
As this topic is rarely documented and the link above doesn't provide enough info about how to acheive it:
I ask:
If firebase doesnt support streaming how come we are able to load video directly to videoview?
Tried the same with exoplayer and didn't work?
Thanks for your efforts.
"Transcoding the video into chunks" means dividing it into multiple small pieces (separate files). Those parts are then uploaded to Firebase Cloud Storage.
Once you divided the video into those pieces, you can download them. Since Firebase does not support streaming, you have to download each chunk entirely before playing, but the trick is that you only have to download that chunk, not the entire video.
Does that answer your question?

How to implement feature like YouTube offline save video in my Android app

How does the YouTube offline feature work? I want to implement this feature in my app. Is there any solution?
Youtube Offline Features works in following manner:
Youtube app downloads the video.
Saves it into youtube app's data directory in encrypted format so other apps can't access it.
Encryption is done so that video can not be played by any other apps even if video is extracted from youtube app data directory on rooted Android device.
Video is decrypted while playing offline in the youtube app.
Video is deleted after a predefined time.

Android Youtube Download mp3

Assume I have the id (The numbers and signs in the video's hyperlink after "http://www.youtube.com/watch?v=") of a Youtube video. How can I download the audio stream of the file to an sd-card as an mp3 with android code? (I wrote an application for 2.x but this part is missing).
Look at how some other YouTube scrapers do it, e.g. youtube-dl. Then recreate their algorithm in Java for Android. Then keep spending time trying to stay up-to-date with the capricious changes YouTube will make to their site every now and then.

How to simultaneously play/stream a video and save it?

I'm working on an iOS and Android app that allows the user to stream/play videos.
I would like to create an offline mode that gives the user the ability to play an already-saved video. To do so, I would like the app to save locally the currently played video if the user has a WiFi connection.
To do that, I would need a mechanism to read and save at the same time a video.
Any ideas to do that on iOS or/and Android?
read and save at the same time
I guess you would have to span two different threads : one to read, and another to save.
And have the 'read' method try to get data from cache before downloading it.
on iPhone, possible duplicates :
Play video from cache in iphone programatically
Simultaneously stream and save a video?
The method described in these answers - caching download on disk, and read video from that file - should be the same for Android.

Categories

Resources