my samba Share file path is : smb://10.0.0.18/MZAES_Songs/Aashiqui 2/Asan Nahin Yahan.mp3
How can I give this path to android mediaPlayer?
For example for local memory file can be played as
String filepath = "sdcard/emulated/0/ashqui/asaa.mp3";
mediaplayer.setDataSource(filePath");
mediaPlayer.prepare();
mediaPlayer.start();
etc..
But how to do with samba shared file path...
Actually Media Player can't play samba share files( as per my knowledge ). So you have to select another way to play those files.
I had solved this problem in this way,
By using NanoHttpClient( 3rd party API ). This API(library jar file), you can get it from Google search.
Download and integrate it to your project.
Then serve your smb file on your device only.
And give that path to your Media Player( http link ). Hope i have answered well.
Related
I'm trying to create an AWS video streaming App on Android. but I have to download the video for offline streaming. but thing is that I want to hide the video files, like youtube or NetFlix.so if anyone can explain how to hide downloaded files....pleasse help me . Thank you :)
You can use app-specific files directory, no one can see files...
You can access files directory via,
in Kotlin
val file = File(context.filesDir, filename)
in Java
File file = new File(context.getFilesDir(), filename);
for more details https://developer.android.com/training/data-storage/app-specific
I working on media application, On app user able to watch video on any video player. all media file is stored in Internal Storage which is .mp4 formate in particular folder called LearningVideo.
My question is I want to encrypt that video so a user won't able access that and also decrypt that video when app play that.
So how can I achieve this task, please help me.
I tried com.google.android.exoplayer:exoplayer:2.6.0
Use CipherOutputStream and CipherInputStream for encryption and decryption of file in android.
There are two ways through which you can achieve your goal
Download a file and encrypt it, when you want to play that file decrypt it in a temporary file and play it.
if you want to play the encrypted file on the fly (not decrypting it in a temp file) then you can use Libmedia library. It streams encrypted file on localhost and plays it from there
Try to write Files inside FilesDir may be this solved your issue
File rootpath = getApplicationContext().getFilesDir();
File path = new File(rootpath.getAbsolutePath() + "/LearningVideo");
You can store your files inside /data/user/0/<packageName>/files
I am developing an android application for Online Music streaming. I want to download MP3 files from the server and play that file when the user is offline. And the downloaded file can only be played through applicaion
please give your best solution
We want to play m3u8 with ts files stored locally on SD card in Android 4.0 and above devices.
I tried using video TAG inside HTML residing locally on the SD card and android native media player.
Both the codes are failing with the error. The same set of ts and m3u8 files are working fine when played from online when served from a webserver connected through http.
Can we play m3u8 using native support for files stored offline or do we need to use 3rd party libraries. I searched in internet and didn’t find article about not supporting the same.
Any help or recommendation would help my work.
Thanks a lot
Issue Solved
we used nano http server to serve m3u8 file to with all videos parts. Very simple and easy way to play m3u8 video file.
I am trying to play an .pls file (available at http://stream.radiosai.net:8002/listen.pls) in android 2.2. But it isn't working. Playing MP3 works fine.
A pls or a playlist file is basically a text file with the path of each track in each entry. Kind of like an .ini file. Take a look at the WP entry.
I don't think the inbuilt MediaPlayer supports these formats, so you'll have to download the file and parse the file and play the actual mp3's one by one.
Android doesn't support the .pls format. Link