Making VideoView play automatically

by Miguel Paraz » Sat, 25 Apr 2009 14:40:17 GMT


Sponsored Links
 Hi,
How can I make a VideoView play immediately, without the user having
to select the MediaPlayer UI Play button? Thanks!
--~--~---------~--~----~------------~-------~--~----~



Making VideoView play automatically

by Nithin Varamballi » Sat, 25 Apr 2009 14:55:56 GMT


 HI...
          Create one one obect of VideoView
         then give objectname .start();

Thank You
Nithin N V

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Making VideoView play automatically

by Miguel Paraz » Sat, 25 Apr 2009 16:27:03 GMT


 



Thanks for the reply!

Nothing happens, though. No logcat logs.


--~--~---------~--~----~------------~-------~--~----~



Making VideoView play automatically

by Nithin Varamballi » Sat, 25 Apr 2009 16:33:05 GMT


 Try this code... This code woks for me......

package mypack.mydemos;

import android.app.Activity;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;

public class demo extends Activity {
    /** Called when the activity is first created. */
        private VideoView myVideo,myVideo1;
        private MediaController mc,mc1;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        getWindow().setFormat(PixelFormat.TRANSLUCENT);
                setContentView(R.layout.main);
        
                        myVideo1=(VideoView)findViewById(R.id.video);
                        myVideo1.setVideoPath("/sdcard/nithin.mp4");
                        myVideo1.start();
                        mc1=new MediaController(this);
                        mc1.setMediaPlayer(myVideo1);
                        myVideo1.setMediaController(mc1);
                        //mc.show(RESULT_OK);
                        myVideo1.requestFocus();
    }
}

Thsnk You
Nithin N V

--~--~---------~--~----~------------~-------~--~----~



Making VideoView play automatically

by Miguel Paraz » Sat, 25 Apr 2009 18:31:55 GMT


 


Yes, it works!

The key is to start() before attaching the MediaController.

Thank you.
--~--~---------~--~----~------------~-------~--~----~



Making VideoView play automatically

by l hx » Tue, 28 Apr 2009 20:21:01 GMT


 now i found a matter in my device,but the emulation is ok. that is, when  i
use the movieview in camera to play video ,but when i come back to another
activity in my app. the orientation of the screen is also transverse. who
know why?





--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. problem in Importing Packages

Hi Everyone
Brother currently i m new to android and now i developing Gtalk Like
Application.
but when i import package i.e

import com.google.android.gtalkservices.IGTalkService;

IDE give me Error like Can not resolve .

What should i do.
Kindly plz Help me.

-- 

2. RelativeLayout and getTextBounds

Hello,

I want to add a RelativeLayout and set its height according to size of
a font.
I added this code:

Rect rect = new Rect();
paint.getTextBounds("A", 0, 1, rect);
ViewGroup.LayoutParams params1 = new
ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, rect.right
- rect.left);
RelativeLayout rl = new RelativeLayout(context);
rl.setLayoutParams(params1);

Than I add a new TextView to this RelativeLayout.

But I can see only small part of the text.

How can I measure the height I will need to this layout before the
onMeasure or onLayout.

Thanks,
Sharon

-- 

3. Switch between profile

4. Add a third-party to the emulator ?

5. Android Tablet (2.2) Recommendations for Development

6. Message not getting posted

7. how to get device orientation at runtime