Fields Summary |
---|
public static android.view.SurfaceView | mSurfaceView |
private android.widget.MediaController | mMediaController |
private String | urlpath |
private android.media.MediaPlayer | mpmidi |
private android.media.MediaPlayer | mpmp3 |
private String | testfilepath |
public static android.content.res.AssetFileDescriptor | midiafd |
public static android.content.res.AssetFileDescriptor | mp3afd |
public static android.graphics.Bitmap | mDestBitmap |
public static android.widget.ImageView | mOverlayView |
private android.view.SurfaceHolder | mSurfaceHolder |
private String | TAG |
private PowerManager.WakeLock | mWakeLock |
Methods Summary |
---|
public static boolean | checkStreamingServer()
InetAddress address = InetAddress.getByAddress(MediaNames.STREAM_SERVER);
return address.isReachable(10000);
|
public void | onCreate(android.os.Bundle icicle)Called when the activity is first created.
super.onCreate(icicle);
setContentView(R.layout.surface_view);
mSurfaceView = (SurfaceView)findViewById(R.id.surface_view);
mOverlayView = (ImageView)findViewById(R.id.overlay_layer);
ViewGroup.LayoutParams lp = mSurfaceView.getLayoutParams();
mSurfaceHolder = mSurfaceView.getHolder();
mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
mSurfaceHolder.addCallback(this);
//Get the midi fd
midiafd = this.getResources().openRawResourceFd(R.raw.testmidi);
//Get the mp3 fd
mp3afd = this.getResources().openRawResourceFd(R.raw.testmp3);
mOverlayView.setLayoutParams(lp);
mDestBitmap = Bitmap.createBitmap((int)640, (int)480, Bitmap.Config.ARGB_8888);
mOverlayView.setImageBitmap(mDestBitmap);
//Acquire the full wake lock to keep the device up
PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "MediaFrameworkTest");
mWakeLock.acquire();
|
public void | onDestroy()
super.onDestroy();
mWakeLock.release();
|
public void | startPlayback(java.lang.String filename)
String mimetype = "audio/mpeg";
Uri path = Uri.parse(filename);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, mimetype);
startActivity(intent);
|
public void | surfaceChanged(android.view.SurfaceHolder holder, int format, int w, int h)
//Do nothing in here. Just print out the log
Log.v(TAG, "Test application surface changed");
|
public void | surfaceCreated(android.view.SurfaceHolder holder)
|
public void | surfaceDestroyed(android.view.SurfaceHolder holder)
//Can do nothing in here. The test case will fail if the surface destroyed.
Log.v(TAG, "Test application surface destroyed");
mSurfaceHolder = null;
|
public static void | testInvalidateOverlay()
mOverlayView.invalidate();
|