Need Help - activity or service

All your problems with Audio, Video and Images.

Need Help - activity or service

Postby heroandroid » Thu Jul 22, 2010 2:54 pm

Hi,

I'm writing a mediaplayer app. It's not something that anybody but me would use.
It must work as follows:
The app must automatically start at bootup.
It must then read the playlist from a file and start playing. It must be able to play video, music and show images!
The app will run 24/7/365.

I got most of this working already, with some exceptions (I will get to that in a bit)
1.) Now what I want to know is: Should I use an activity or a service?
2.) If I use a service, must I autostart an activity, which in turns start the activity, which in turn starts the playing of items?
3.) Would it be better to start seperate sub-activities for each of the media types? (ex. start sub-activity, play video, finish sub-activity) Or should I just play all of the media types in the same activity.

The stuff that I am struggling with at the moment are:
1.) I play the video using videoview, but I can't get it to strech the video to fullscreen.
2.) I acquire a wakelock to keep the screen on and keypad backlight off, but as soon as a video stops playing, and the audio starts playing, the keypad backlight comes on and stays on (the screen backlight also stays on). I would to turn off the backlights, how? I tried to acquire another wakelock with different flags set, but it doesn't seem to work. I use the MediaPlayer class to play audio.

Any help will be appreciated?
Regards
heroandroid
heroandroid
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Jul 08, 2010 10:22 am

Top

Re: Need Help - activity or service

Postby blundell » Thu Jul 22, 2010 3:48 pm

Oh how this sounds like malware/spamware but I'll give you the benefit of the doubt.

In my experience don't use VideoView as you won't get fullscreen, or try orientation="horizontal" with some luck

Just write it all into one activity and run a thread to play the sound , but your image and video will be in the UI thread.

You'll only need a service if you want the user to do other things whilst your app is on. If you want your app to stay on whilst your user closes it (to continue the sound) you can spawn a service in onStop(); and kill it and take control in onResume();

For the wakelock thing never played with them myself, but maybe when the audio media player starts it has options to skip back an forward therefore the keyboard becomes active? have a look at disabling these, just a guess.
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Re: Need Help - activity or service

Postby heroandroid » Fri Jul 23, 2010 8:10 am

Thanks, Your help is greatly appreciated! Nope, not malware or spamware! This app is for my company, it will probably not even be available on the market (maybe just to make updates on site easier)! But no one will even know how it works! But anyway, thanks, I'm definitely going with your opinion!

Should I use surface for the video playback?
heroandroid
Junior Developer
Junior Developer
 
Posts: 10
Joined: Thu Jul 08, 2010 10:22 am

Re: Need Help - activity or service

Postby blundell » Fri Jul 23, 2010 9:28 am

Yeah Surface view, this guy implements it here:
VidTry Source
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 11 guests