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. OpendGL ES porting on hardware accelerators on android

Hi All,
As i am beginer to android & openGL ES, i have some queries regarding
porting OpenGL ES on Graphic accelerators. Could you please tell me
how do i start with the porting activity?
- Is there any tutorial which talks about this.
Can anybody give some some direction so that i can start learning
these things...

Thanks

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. How to create world readable file

I am trying to launch package installer to install an APK file that I have
already installed:

    private void installApk(String file) {
        Uri pkgUri = Uri.parse("file://" + file);
        Intent intent = new Intent();
        intent.setData(pkgUri);
        intent.setClassName("com.android.packageinstaller",
"com.android.packageinstaller.PackageInstallerActivity");
        startActivity(intent);
    }
Now, this is all fishy, I know, depending on undocumented (?) behavior of
PackageInstallerActivity. My problem is I need to give a file that
PackageInstallerActivity can read.

I tried many things:

(1)
FileOutputStream fout = Context.openFileOutput("xxx.apk",
Context.MODE_WORLD_READABLE);

But this file is created in a directory /data/data/<app>/files, which is
mode drwx------, so other processes cannot read it.

(2)
File dir = Context.getDir("downloader", Context.MODE_WORLD_READABLE);

But there's no way for me to create a File inside the <dir> with world
readable permission

(3) this one works, but is extremely convulsing:

            SharedPreferences pref =
mReader.getSharedPreferences("nubi.apk",

Context.MODE_WORLD_READABLE);
            SharedPreferences.Editor editor = pref.edit();
            editor.putInt("text_size", 0);
            editor.commit();
            file = mReader.getFilesDir().getParent() +
"/shared_prefs/xxx.apk.xml";

I tried this, and I was actually able to invoke the PackageInstallerActivity
to install my APK file. I tested on cupcake and 1.0 emulator.

On well....

I looked at the Browser, and it uses a permission

android.permission.ACCESS_DOWNLOAD_MANAGER

But this doesn't seem to be documented either. (See

3. Need someone with a phone to confirm our app works

4. Getting Current Location on my Device works on emulator but not on my device

5. Writing widgets *without* persistent services

6. music player crash

7. How to start other activity by code