Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 894287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:21:34+00:00 2026-05-15T14:21:34+00:00

What I’m trying to do is play the first video retrieved from the external

  • 0

What I’m trying to do is play the first video retrieved from the external SD card, which on my T-Mobile G2 turns out to be the sample video for the phone. Now I assumed that since it plays in the phones video player, that it’d have no problems playing in the VideoView in my test app.

However, all I get is the audio playing. I’m pretty sure the code is all fine. After all, it’s pretty simple.

All I can think is that maybe the phones video player uses some native playback function which supports more video formats?

I’ve also tried playing the mv4 (actually an MP4 file) and the 3gp files from this site http://support.apple.com/kb/HT1425, but pushing them on to the emulator SDCard. Both of them exhibit the same problem – there is audio, but no video!

Could I be missing a permission somewhere or what could explain this behavior?

Code:

public class Video extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        
        requestWindowFeature(Window.FEATURE_NO_TITLE);  
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,   
                                WindowManager.LayoutParams.FLAG_FULLSCREEN);  
        
        setContentView(R.layout.video);
        
        // Get the external storage state
        String state = Environment.getExternalStorageState();
        
        // Check if we can read it in
        if (Environment.MEDIA_MOUNTED.equals(state)==false&&
         Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)==false)
        {
         // We can't read from the memory card, so warn and return;
         Toast toast = Toast.makeText(this, 
           "The SD card is either missing or not in a readable state.", Toast.LENGTH_LONG);
         toast.show();
         return;
        }
        
        // Get a cursor to the video files
        Cursor cc = this.getContentResolver().query(
          MediaStore.Video.Media.EXTERNAL_CONTENT_URI, 
          null, null, null, null);

        // Get the video column index
        int videoIDColumn = cc.getColumnIndex(MediaStore.Video.VideoColumns._ID);
        
        // Iterate though the videos pointed to by the cursor
        if (cc.moveToFirst())
        {
          int videoID = cc.getInt(videoIDColumn);
          Uri videoPath = Uri.withAppendedPath(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,String.valueOf(videoID));
          
          // Log and add an image to the view
          Log.i("Video Found",videoPath.toString());
          
          VideoView videoView = (VideoView)findViewById(R.id.VideoTest);
          videoView.setVideoURI(videoPath);
          videoView.start();
        }
        else
        {
         Toast toast = Toast.makeText(this, 
           "Can't find a video to play.", Toast.LENGTH_LONG);
         toast.show();
        }
    }
}

Update

I’ve tried using android 1.5 and 1.6, but the problem still persists.

Also, I just checked logcat and there are no errors for any of the other files, but for the .3gp I get this error:

07-02 10:53:31.181: INFO/Video Found(235): content://media/external/video/media/2
07-02 10:53:31.383: VERBOSE/VideoView(235): reset duration to -1 in openVideo
07-02 10:53:31.541: INFO/ActivityManager(58): Displayed activity com.dvl.testing/.screens.Video: 533 ms (total 533 ms)
07-02 10:53:31.693: WARN/PlayerDriver(31): Using generic video MIO
07-02 10:53:31.883: ERROR/SW_DEC(31): PV SW DECODER is used for MPEG4
07-02 10:53:31.922: DEBUG/AudioSink(31): bufferCount (4) is too small and increased to 12
07-02 10:53:32.322: INFO/ARMAssembler(58): generated scanline__00000077:03010104_00000004_00000000 [ 22 ipp] (41 ins) at [0x2166f8:0x21679c] in 3379159 ns
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T14:21:34+00:00Added an answer on May 15, 2026 at 2:21 pm

    Wow, sometimes I hate the android documentation.

    Turns out that in my case, I was specifying a background colour for the VideoView in xml, but instead of being the background colour which I assumed would show while the video is loading / buffering, it was in fact the foreground and being rendered over the video which was playing perfectly behind it! lol

    So changing:

    <VideoView 
      android:id="@+id/VideoTest" 
      android:background="#FF00FF00" 
      android:layout_width="wrap_content"
      android:layout_height="wrap_content">
    </VideoView>
    

    to

    <VideoView 
      android:id="@+id/VideoTest" 
      android:layout_width="wrap_content"
      android:layout_height="wrap_content">
    </VideoView>
    

    Works a treat for me and my videos are now showing! 🙂

    Hope this helps someone!

    Andy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.