playing video using monkeyrunner - android

I am playing a mp4 file using monkeyrunner's startactivity function,it is working.Now,i want to know whether the video is still playing or has ended.But,as monkeyrunner doesn't wait for the video(or any other activity)to finish or say "return".How to know whether the video finished or not?

You'll need to look at the android debug log in a sub-process. Hopefully the app that you are using to play the mp4 will have some type of log output when it finishes playing the file.

If you play the video file with the Gallery app, when you start playing the file, the logcat will show:
Displayed com.android.gallery3d/.app.MovieActivity
After the app finishes playing the file, the logcat will show:
Displayed com.android.gallery3d/.app.Gallery
You can look for these strings in the logcat.
As a side note, there are some system properties that you can check using monkeyrunner:
device.getProperty('am.current.package')
device.getProperty('am.current.action')
These show the package name of the currently running package and the current activity's action. Unfortunately when i used them, they returned a blank string, not the names I wanted.
I hope this is useful.

Related

How to get currently plaing audio file info in background (The audio may be playing by any app) in android

I'm going to make one app, in this the partial requirement is like this: get the currently playing audio name using service. I tried but I'm unable to find the exact way, here is my finding. How to get all the audio file using mediastore
There is no way to know what file another app may be playing.

Widevine and MPEG-DASH - offline playback

I have created an Android application which is capable of playing movies, which are protected with DRM (Widevine Modular). Video are in MPEG-DASH standard. In case, that device is online, everything works fine.
Now I need to add feature for playing video in offline mode. The problem is that I do not know how can I download some file(s) for offline playback. Everything what I have is .mpd file, which contains structured data.
How can I get some file(s) for download from this manifest .mpd file? There are no direct links to some video. I see some chunk, which looks like this:
media="chunk_ctvideo_cfm4s_rid$RepresentationID$_cs$Time$_w1003607280_qaWQ9QVBsSUxIMUpaRnVfdfdfkstMDImYXdsgdreaW9pbmRleD0w_mpd.m4s
I do not know if it is useful for me, but there is nothing more "noticeable" in the manifest file.
For an example of code that processes a manifest and downloads the media chunks have a look here: https://github.com/axiomatic-systems/Bento4/blob/master/Source/Python/utils/mp4-dash-clone.py
Of particular interest you may find the ProcessUrlTemplate which shows how to pass the media elements to get a URL for a chunk

How to make a self phone call which plays mp3 when answered?

I'm trying to make an an android app whereby if the user answers the phone call the mp3 file will start and the voice of the call will be the mp3 file.
Meaning when the app is triggered, it'll make a phone call to itself and when you answer it, the mp3 file will act as the voice behind the phone call.
I know how to make a simple phone call app, but I can't get it to call itself nor making the mp3 file play as the voice from the other side of the phone. Any guides on how to perform this?
A similar question about having a phone call itself was answered here, and says that this is not possible (which makes sense). As recommended there as well, your best bet is to probably use MediaPlayer to play the MP3 file to the user, and make the application look like a phone app if it really needs to be like a call.

Kivy Play Audio Not Working

I'm attempting to run Kivy's audio example found here. The specific example is this:
sound = SoundLoader.load(filename='test.wav')
if not sound:
# unable to load this sound ?
pass
else:
# sound loaded, let's play!
sound.play()
When attempting to play any .wav file in my directory however, I just hear a click or pop noise. I've tried with different .wav files and am experiencing the same problem. I've also attempted to print out the length of the sound by using the length function, but it returns 0 for some reason. Any feedback or input from you guys? Thanks again.
Can't say just looking at the snippet above how you've implemented it in your Application or what's wrong.
There is a more elaborate example should be in the examples directory under your Kivy install directory that should clear up how to use SoundLoader.
Hope that helps.

Playing MP3 file from SD card in background of Android app

I have got some code which displays a listview of audio files in SD card and plays them. But when I move to other screens, it automatically stops. I want it to be able to play the files while using the other functions of the app.
use AsyncTask ( or any sub-class in that constructor chain ) and as well consider Service but best case is to do AsyncTask and remember you have to start the thread yourself- just like is says in the docs for that
If you want your media to play in the background even when your application is not onscreen—that is, you want it to continue playing while the user is interacting with other applications—then you must start a Service and control the MediaPlayer instance from there.
Please refer this link its nice example for Android Music Player.

Categories

Resources