Hi Madhuri, You need to do the following to get video icon on android desktop:
1) In file "packages/apps/Music/AndroidManifest.xml" uncomment the lines for video functionality, this will create a video icon on desktop. 2) Then you should set "mEmulation" to true in AndroidSurfaceOutput constructor which is present in file "external/opencore/android/ android_surface_output.cpp" . This action will force the system to use ashmem heap instead of pmem_adsp. 3) Now build the andriod rootfs again by doing "make" and you will find a video icon on desktop, which will play mp4 & 3gp files. On Jan 15, 11:53 am, Madhuri <[email protected]> wrote: > Hi All, > > I tried to run the media player coding as: > > Sample.xml: > > <?xml version="1.0" encoding="utf-8"?> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ > android" > android:orientation="vertical" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > > > > <SurfaceView android:id="@+id/surface" > android:layout_width="fill_parent" > android:layout_height="250px" > android:layout_gravity="center"> > </SurfaceView> > </LinearLayout> > > Sample1.Java > > package com.Test; > > import java.io.IOException; > > import android.app.Activity; > import android.graphics.PixelFormat; > import android.media.MediaPlayer; > import android.os.Bundle; > import android.view.SurfaceHolder; > import android.view.SurfaceView; > import android.widget.Button; > import android.widget.VideoView; > > public class Sample1 extends Activity implements > SurfaceHolder.Callback > { > Button button=null; > VideoView mVideoView; > MediaPlayer mediaPlayer; > private SurfaceView videoView; > private SurfaceHolder videoHolder; > Bundle extras; > @Override > public void onCreate(Bundle savedInstanceState) > { > getWindow().setFormat(PixelFormat.TRANSPARENT); > videoView = (SurfaceView) findViewById(R.id.surface); > videoHolder = videoView.getHolder(); > videoHolder.addCallback(this); > videoHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); > videoHolder.setFixedSize(videoView.getWidth(), 300); > > try { > playmedia("/root/test_cbr.mp3"); > } catch (Exception e) { > // TODO Auto-generated catch block > e.printStackTrace(); > }} > > private void playmedia(String songpath) throws > IllegalArgumentException, IllegalStateException, IOException { > mediaPlayer = new MediaPlayer(); > mediaPlayer.setAudioStreamType(2); > mediaPlayer.setDataSource(songpath); > mediaPlayer.setDisplay(videoHolder); > > mediaPlayer.prepare(); > mediaPlayer.start(); > } > @Override > public void surfaceChanged(SurfaceHolder holder, int format, int > width, > int height) { > // TODO Auto-generated method stub > > } > @Override > public void surfaceCreated(SurfaceHolder holder) { > // TODO Auto-generated method stub > > } > @Override > public void surfaceDestroyed(SurfaceHolder holder) { > // TODO Auto-generated method stub > > } > > } > > I dont see any output in my screen. I see only blank screen.I want > to play the media file.Can any one tell me what is happening in my > code?. > > Thanks, > > Dhuri Natarajan. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

