Android Stop Background Music

I’m very happy today, and still have hair 🙂 I’ve tested this and it works!!! First, add this to your Manifest: <uses-permission android:name=”android.permission.GET_TASKS”/> Second, add this to your ‘Home/Main’ Activity/Class: @Override protected void onPause() { if (this.isFinishing()){ //basically BACK was pressed from this activity player.stop(); Toast.makeText(xYourClassNamex.this, “YOU PRESSED BACK FROM YOUR ‘HOME/MAIN’ ACTIVITY”, Toast.LENGTH_SHORT).show(); } … Read more

camera app not working?

You have to unlock the camera before creating MediaRecorder. And lock it before releasing it. Try this code, it will work Have fun… package com.marcodinacci.book.acb; import java.io.IOException; import android.app.Activity; import android.content.pm.ActivityInfo; import android.hardware.Camera; import android.media.MediaRecorder; import android.os.Bundle; import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.view.View.OnClickListener; import android.widget.ToggleButton; public class MediaRecorderRecipe extends Activity implements … Read more

How to use JavaFX MediaPlayer correctly?

The problem is because you are trying to run JavaFX scene graph control outside of JavaFX Application thread. Run all JavaFX scene graph nodes inside the JavaFX application thread. You can start a JavaFX thread by extending JavaFX Application class and overriding the start() method. public class Main extends Application { @Override public void start(Stage … Read more

How to play m3u8 on Android?

Following this link trail: http://code.google.com/p/android/issues/detail?id=14646 -> http://code.google.com/p/android/issues/detail?id=16884 -> http://code.google.com/p/android/issues/detail?id=17118 (ARGGGGH!) Gives the answer in the end: basically in Android v2.3 & v3.0, use the non-standard httplive:// scheme, in 3.1 use http:// but with some code workaround in how you call the relevant methods in the media framework.

Displaying Artwork for .MP3 file

Change your snippet of code into this (I already tested it): I added println lines commented in places of interest, Feel free to uncomment in order to see what is happening. for item in metadataList { if item.commonKey == nil{ continue } if let key = item.commonKey, let value = item.value { //println(key) //println(value) if … Read more

How to play video stream with MPMoviePlayerController in iOS

Instead of creating a MPMoviePlayerController and adding that to your view, it is probably simpler to create a MPMoviePlayerViewController and present that view controller modally (since you are trying to show your video full screen anyway). Then the MPMoviePlayerViewController can manage the presentation of your video for you. MPMoviePlayerViewController *mpvc = [[MPMoviePlayerViewController alloc] initWithContentURL:url]; [[NSNotificationCenter … Read more

Get cover picture by song

I’m not familiar with MusicUtils, however, you should be able to get the cover art from the file itself by using MediaMetadataRetriever. Here is a brief code snippet showing how to use it. The uri referenced is the content uri for the file you want to retrieve the art for. MediaMetadataRetriever mmr = new MediaMetadataRetriever(); … Read more