I am making a video player app. Lets make myself clear in this app no video or audio files will be saved in the raw directory during making the app. I want an app that will pick a video file from device storage when clicked a button. So please help.
You have a few options for allowing the user to pick a video, including:
Use ACTION_OPEN_DOCUMENT on Android 4.4+. You will get a Uri back that you can pass to VideoView or MediaPlayer.
Use ACTION_GET_CONTENT. Again, you will get a Uri back that you can pass to VideoView or MediaPlayer.
Use a third-party file picker library. Depending on the library, I would expect you to get a File or a Uri back for use with your video player.
The first two techniques are covered in the documentation, along with good books on Android app development.
Related
I have an App, that shows pictures and videos from the Internet.
Now I'm implementing a "save" function, that saves the picture/video to external or internal storage, without downloading them a second time.
For the pictures I just grab the drawable with imageView.getDrawable().
How would I achieve the same with the video thats currently buffered in the Exoplayer2.x / PlayerView? I'm not finding a getMediaSource() function.
You will be able to download certain type of stream. There are subclasses for DASH, HLS, SmoothStreaming and also progressive streams. One Downloader downloads only one stream
https://medium.com/google-exoplayer/downloading-streams-6d259eec7f95
I am developing an application where downloaded video can not be accessed by user outside the app. I want to know how to make it possible that user can not accessed video outside the app and only play it in the app. thanks.
Yes it's possible to do so infact popular apps like youtube do it when you download a video for offline loading. you have to encrypt the video and delete the original. After doing that decode it back when you want to play
I have an app which is using android webview .i am able to stream video in webview .i want know how can i allow users to to save videos automatically in thier internal storage which they stream in webview on website ? Thanks in advance
Most videos streaming to a browser (PC or mobile) will not allow download as the owner of the video may not want to allow it be saved and copied etc.
Simple http progressive download may allow you to save the video in a regular browser by simply right clicking on it.
DRM protected video will generally use a video pipeline (a sort of 'path' through your device) that does not allow an application of any kind access the raw video - this is again is to avoid people making unauthorised copies.
If you think the video in your case is allowed to be copied then you may find it easier to write some functionality to act as the streaming client and save the file locally. You could also pass the received stream along to the media player or to a webview if you wanted to play the file in parallel to saving it.
I have an app which I want to store audio files in mp4 format in a folder of my choice.
I want to share some of them in Facebook but I dont have the facebook option while if I have a mp4 video file in my device's media library, I have full list of options and facebook, and I have the mp4 video file ready to be shared.
Why is that? Do I have to add some extra info while saving them on the first place?
Do I have to save them in main device media library?
You have to put an image or video while recording because in some way the system knows it is just an audio so even if you copy the audio mp4 to the main media library you won't see any difference
I am implementing android application to capture and play video using Surface-view (or) Video-view classes and saving it on External SD-Card properly. My main problem is i am taking that saved video into windows system which is saved on SD-card, then when i play that video now i need to display the captured date and time on top of that video.
So could you please let me know the possible scenarios or else if any one have some sample code related to this could you please share with me.
Thanks,
Android Team.
windows system which is saved on SD-card
whaat?
i need to display the captured date and time on top of that video.
if you need to get the time/date of the video, you can use the lastModified() method:
File file = new File(pathToVideo);
Date date = new Date(file.lastModified())
To display it when you are playing the video there are several ways, for example you can display it inside the ActionBar. For a video playback Activity it is typical to use an overlay ActionBar, so use this before calling setContentView():
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
You can use ActionBar.setCustomView(your_action_bar_custom_layout) to display the date/time or simply use the title/subtitle:
getActionBar().setSubtitle(date.toString());