Android :: How To Use Media Player In Library Class?
Feb 25, 2009
I have successfully implemented the Media Player for my apps, but when I tried to use some of the callback methods I ran into a problem.What I'm trying to do is use Media Player in a reusable (library) class.This MediaPlayer is created by passing the Activity Context to it's constructor.I then use getApplicationContext to avoid any potential memory leaks.This works well and I'm quite happy with it.My problem is trying to use callbacks.When I implement MediaPlayer.OnPreparedListener in my class.I believe this is due to the class itself not being an Activity.When I implemented the callbacks in a separate test project, the mp.prepare () works fine. I cannot use a passed context to my library class, as that would require the Activity to implement the listener and not my library class. How can I create a library class that creates/uses MediaPlayer and it's callbacks without making it extend Activity?Is this not possible?
View 3 Replies
Jul 21, 2010
I am currently new to android development I been working on the examples in the Dev Guide in the android website. I want to get a stream from a server I have to play in the emulator when I insert the url it doesn't seam to want to play. My question is there a way to get the emulator to play audio or is it all enabled also does MediaPlayer require a special kind of format like mp3 or ogg? his is the code i am running on my 'onCreate()' method.
MediaPlayer mp - new MediaPlayer();
mp.setDataSource(MY_URL_);
mp.prepare();
mp.start()
View 1 Replies
View Related
Aug 28, 2010
I'm attempting to make a simple homebrew game engine/framework in android. I have the "engine" as a library project that handles all of the graphics rendering, game activity, and whatnot. Essentially, the library project has a class GameMain which has a background image, an array of drawables, and a few functions (the most important is a run() function). The projects that use this library extend this class with their own unique run() function. The idea is that games that use the engine start with their own activity, launch the GameActivity from the library, and pass their unique GameMain child object into the library, which should run the unique run() method thanks to polymorphism.
Getting this to work, however, has been a struggle. I originally attempted to make the GameMain Serializable, which didn't appear to work. I'm now attempting to make it a Parcelable, but it does not appear to run the child objects run() function when called from the library. I'm wondering, are Parcelable objects actually capable of sending Object methods across activities? Am I going about this the wrong way, or am I just having some other weird bug I have not uncovered?
View 1 Replies
View Related
Jun 26, 2010
I am trying to add an 'Android Library project' I have created to another regular Android project. The Library Project had a jar dependency and was also dependent on another java project in my workspace. I had to add both of these to the my 'regular Android project' because otherwise Eclipse could not find them (Not sure if this was the right thing to do because it would mean that I will have to manually update all projects when the library gets another jar dependency). Anyway, the errors went away and now the Regular Android Project can't find the R class, I have tried a clean but it did not work. I checked in the /gen folder and both the R classes are there - from the library and the regular project.They have the correct strings inside them.
View 1 Replies
View Related
Oct 29, 2009
After getting comfy with the Android 2.0 environment and emulator (for the most part), I took the next step to bind <myapp> against the latest Android 2.0 jars: android.jar and maps.jar. The existing code (working in Android 1.6) did not need any changes to compile, but the app doesn't build due to a weird error message that prevents the build. See snippet below, drawn from the Eclipse Console. I have no aspirations to run up against any core library classes, and I am not aware I do. In other words, I am not implementing SealedObject (or any other core class that I am aware of) that would run up against Dalvik. Not in the javax, java or any other namespace. Anybody got any pointers what's going on here?......
View 6 Replies
View Related
Dec 9, 2013
I have a thread on StackOverflow (titled: NoClassDefFoundError for Jersey 2.4.1 client in Android) but I thought I would reach out here in hope of getting a more specific/targeted audience group.I have followed instructions from other posts about the libs Android dependency fix but I still get the issue.
I am using Eclipse Juno, with an Android App targeting API 17. Basically I am getting a NoClassDefFoundError at runtime for the org. glassfish. jersey. model.internal.CommonConfig$1 class located in jersey-client-2.4.1.jar. This is when I just do a Run As... deploy from within Eclipse and it fails when I instantiate the CommonConfig class or one that depends on it internally. The start up log is given below:
[HIGH]12-10 12:25:20.657: I/dalvikvm(10170): Failed resolving Lorg/glassfish/jersey/model/internal/CommonConfig$1; interface 920 'Lcom/google/common/base/Function;'
12-10 12:25:20.657: W/dalvikvm(10170): Link of class 'Lorg/glassfish/jersey/model/internal/CommonConfig$1;' failed
12-10 12:25:20.657: E/dalvikvm(10170): Could not find class 'org.glassfish.jersey.model.internal.CommonConfig$ 1', referenced from method
[code]....
It doesn't seem to find a static inner class of CommonConfig. In the SO forum I tinkered with some options in ProGuard but I've come to learn that this isn't even used in the standard debug mode, only when you do a release build (Export from Eclipse). It would appear that something is happening with the class but I can't figure out why it would not be included if its parent is. Is there some kind of 'light' ProGuard process that goes on when a debug deploy is done? how to resolve this particular case of NoClassDefFoundError?
View 4 Replies
View Related
May 14, 2010
In the spirit of using existing, tested and stable libraries of code, I started using the Apache-Commons-Math library and its BigFraction class to perform some rational calculations for an Android app I'm writing called RationalCalc.
It works great for every task that I have thrown at it, except for one nagging problem. When dividing certain BigFraction values, I am getting incorrect results.
If I create a BigFraction with the inverse of the divisor and multiply instead, I get the same incorrect answer but perhaps that is what the library is doing internally anyway.
Does anyone know what I am doing wrong?
The division works correctly with a BigFraction of 2.5 but not 2.51, 2.49, etc...
[UPDATE]
This was indeed a bug in the apache-commons-math 2.0 libraries. The bug is fixed in v.2.1.
It is now listed in the Fixed Issues section of the bug tracker:
When multiplying two BigFraction objects with numerators larger than will fit in an java-primitive int the result of BigFraction.ZERO is incorrectly returned..attempting to reproduce the issue and setting me on the right track.
CODE:.....................
View 1 Replies
View Related
Jan 10, 2010
Even registering the broadcast receiver at the highest priority still fails to receive the Bluetooth media button events on the HTC Hero phone. The Bluetooth media button registration code works fine on the other Android phones that I have tested. Apparently this isn't the first time HTC has done something like this, as I also found a report of a similar problem on one of the HTC Microsoft Mobile Devices reported here
It seems extremely short sighted of HTC to code their media player so that it grabs the Bluetooth AVRCP media button events in such a way that other applications are unable to work with the Bluetooth head phone buttons and Bluetooth in car stereo systems.................
View 2 Replies
View Related
Nov 10, 2010
I use Windows Media Player to manage all my mp3s and playlists. I want my Samsung Galaxy S to be synchronized with my PC. I can connect my Galaxy S using "Media Player" mode and use the built-in sync with WMP, but there are issues:
1) Some mp3s get "corrupted" - how do I force WMP to "re-sync" them without losing my playlist association (if I manually add it as a file to sync, it is no longer associated with the playlist)
2) If I delete an mp3 from the device, WMP doesn't realize and won't re-sync the file again... is there a way to re-sync?
3) Sometimes WMP will re-sync playlists and each song shows up 3-4+ times when I load up a playlist on my device. I then have to wipe the Music and Playlist folder and re-sync from scratch any way around this?
4) Where are android playlists stored? The Playlists folder on the sd card can be wiped, but the playlists still show up in the music player?
5) If I make a change to a playlist on my PC, WMP will freeze and start skipping random files the playlists get corrupt and I see problem #3 occur. Essentially, if I change a playlist, I have to wipe the Music and Playlist folder and re-sync from scratch.
View 7 Replies
View Related
Feb 28, 2010
I altered some of the tags (genres) in my mp3 coll, but I keep seeing the old ( no longer present) tags, how do I convince the music player to rescan my SD?
View 1 Replies
View Related
Jul 7, 2010
I have develop and app that downloads music files and should add them to the music library.
View 8 Replies
View Related
Sep 1, 2010
Does anyone know where to find a media player that would allow you to play streaming videos on Android Browser?
I want to know if you can play streaming videos on your web browser on your android os phone.
View 1 Replies
View Related
Apr 8, 2010
I want to be able to use/view the video's I record with my phone on my computer. (open from an email or use in window's movie maker)I have a new computer with Windows seven at work and a Vista laptop at home. I can send the video to myself and try to open in from my email or tether to the computer and transfer the file manually. Either way I can't open with windows media player. Video's taken with default "Camcorder" app on a myTough 3G running Android 1.6.I know it has something to do with the codec's the phone uses but wonder why they wouldn't use codec's that are compatible with the most commonly used pc's?Is there any way around this? Some kind of converter for the computer or for the phone?Is there another camcorder app that can record video with a different codec or is it phone hardware specific?So far have been able to use these forum's to sort out most of my Android problems but I'm stumped on this one. It doesn't seem like it should be this hard to do. Should be more user friendly.
View 5 Replies
View Related
Jun 7, 2010
Sync Music to Nexus One using itunes and Windows Media Player. This process automatically creates a Music folder at the root level of the SD card. Hopefully some of you find this useful, especially coming from using iTunes Read more
View 3 Replies
View Related
May 24, 2010
I found that there is difference in class name of the YouTube player between devices: Some call t 'com.google.android.youtube.PlayerActivity' and some 'com.google.android.youtube.YouTubePlayer' My question is: Is there a way to retrieve the class name?
View 5 Replies
View Related
Sep 12, 2010
I have just got a HTC desire and like many people would like to be able to get rid of my iPod all together and have just my phone. The problem I'm having is that the media player on the HTC desire doesn't work nearly as well as iTunes. I have several issues that would needed to be resolved and wanted to know if anyone had a solution to any of them
1) Audio books, I have many of these on my iTunes and on an iPod they are displayed in a separate folder and are removed from shuffles, not so on the HTC, solution?
2) Podcasts, Again i subscribe to many podcasts on my iTunes and wanted to know if there was any way of adding them to my HTC automatically or having them download automatically (Despite this being very annoying and clogging up my hard drive with duplicated podcasts)
3)Playlists I am currently using iTunes agent to sync from my iTunes but it means that I cannot sync playlists that i can then play on my phone. (I can sync playlists just not then play them on their own once they are on my phone)
View 1 Replies
View Related
Jul 7, 2010
I guess no one cares to listen to their favorite music in the order the artist intended? we now listen to timeless classic Opera in whatever order? makes no difference? Classic Rock albums out of order? Pink Floyd "Dark Side of the Moon"?
View 6 Replies
View Related
Jun 7, 2010
The tracks in an album playing alphabetically instead of by the track number?
View 3 Replies
View Related
Jun 16, 2010
After hours of hit and miss using programs like Double Twist etc. I found that the easiest way to sync music to the iHTC Music player is to use Windows Media Player and buy Album Art Grabber to load the album art. Once you have done the initial sync with WMP you can go back and load individual albums simply by dragging them to the sync area. Connect your phone to the PC and unmount the SD card Open WMP and click the sync tab. Click the drive that represents your SD card (mine was H You will be prompted to sync everything for either this session or all sessions. (I always click this session only). Works great and all I will need in the future!
View 5 Replies
View Related
Dec 22, 2009
I've got a ton of music on my SD card in my phone, approx. 6.5GB worth on an 8GB card. The problem is, the music players in Android (I've used the default, RockOn and MixZing, though I want to stay with MixZing) only recognize about 80% of the music, in their libraries. The thing is, the music is there! If I browse to the folder and launch the file it will play, but there's no artist/title data, even though all the files are properly tagged (mp3s), plus, it opens in a weird verion of the default music player that will stop playing if it loses focus.
This has been a issue ever since I got this phone. It's a brand new SD card (my previous one, in addition to this problem, had major corruption issues; I originally thought it was the card but I guess that's not the case). Also, I've gone through two different ROMs (one when I first got the phone, and a second that I upgraded to about a month ago), so I don't think that's the issue. It seems to affect random folders (albums) at different times, whenever the library is refreshed, but I can't refresh the library manually (that I've found) to see if it's just not scanning those files, or if it's a more underlying issue. I'm stumped
View 8 Replies
View Related
Oct 23, 2010
My application gets playlist from a XML file, requests URL of mp3 file from server, downloads and plays it. It was able to download mp3 file but unable to play it. When I used emulator with Android 2.1, it was displayed in LogCat:
[Quote]
View 5 Replies
View Related
Jul 21, 2010
I recently bought some gameloft games for my droid incredible but i noticed all the sounds of music of the games are showing up on my media players. Is there any fix for this issue?
View 2 Replies
View Related
Mar 1, 2010
I'm looking for an app which will let me listen to music through a shared itunes library, or windows media player library - any suggestions?
View 1 Replies
View Related
May 30, 2010
I found this site that says when you mount the phone, is should show up on the list of devices within WMP, mine isn't for some reason
https://supportforums.motorola.com/thread/17148
Does any know what is going on? I am mounting the phone, and can see it as a removable drive under my computer, am I doing something wrong?
View 1 Replies
View Related
Sep 22, 2010
I listen to podcasts and recorded shows that can go on for several hours. I'm looking for a media player with a "skip to" function, so if I get interrupted, I don't have to fiddle with my finger on a slider to find the right section. I just enter "1:33" or whatever and the player goes to that location. Neither the stock media player nor mixzing support that (that I can see). I don't need full RSS support, automatic downloading, I just want a media player that I can skip to a particular spot in a track by specifying the time.
View 8 Replies
View Related
Jul 3, 2010
good mp3 player and video player / HTC EVO. is there anything better than stock
View 5 Replies
View Related
Feb 8, 2014
I have an Android phone and I often watch movies with it. I'm looking for a player that can collect movie info online when I put movie files in my media library.
View 1 Replies
View Related
Nov 17, 2009
Whats the best way to get music from my itunes library to the droid? Unfortunately the new motorola software doesn't support mac, and although I run both windows and osx on my laptop, I'd rather do it natively.
View 1 Replies
View Related
Nov 8, 2009
I am new here been lurking since seeing the droid. Great community here btw. I got my droid friday morning and love it great phone and my 1st android device,coming from a centro.I have a question about the default video player. I bought the act 1 video player because it says it can be used as the default video player but I have no idea how to set it up as the default. I use orb to stream live tv to my phone the default player just doesnt cut it.The act 1 player does a much better job playing the movies I have loaded on the sd card, so I would think it would do better on streaming as well. When I open the stream from orb it opens in the default player. It runs ok for a few mins but quality is not what it should be, on my centro it was better with kinoma player.
View 2 Replies
View Related
Jul 18, 2010
Just got a droid x and love it. However coming from an iphone I am having a difficult time managing podcasts. I tried google listen which is great but doesn't support podcasts that require a login. Also, if I move them manually they get mixed in with all the music. Is there a media player that will separate them out based. On the podcast tag?
View 1 Replies
View Related