2010-07-02 5 views
1

T-Mobile G2에서 외부 SD 카드에서 가져온 첫 번째 비디오를 재생하려고합니다. 전화를위한 비디오. 이제는 휴대 전화 비디오 플레이어에서 재생되기 때문에 테스트 용 앱의 VideoView에서 재생할 때 문제가 없다고 가정했습니다.Android VideoView가 T-Mobile G2 (샘플링 오디오)에서 샘플 비디오를 재생하지 않음

잘못된 ...

나는 모두 오디오를 재생합니다. 나는 그 코드가 모두 괜찮다고 확신한다. 결국 그것은 매우 간단합니다.

내가 생각할 수있는 것은 휴대 전화 비디오 플레이어가 더 많은 비디오 포맷을 지원하는 일부 기본 재생 기능을 사용하고 있을지도 모르겠다.

또한이 사이트의 mv4 (실제로는 MP4 파일)와 3gp 파일을 재생하려고 시도했지만 에뮬레이터 SDCard로 푸시했지만 동일한 문제가 발생합니다. 오디오는 있지만 비디오는 없습니다!

사실, 어딘가에서 권한이 누락 되었습니까?

누구든지이 동작을 설명 할 수 있습니까?

코드 : 고급의

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(); 
     } 
    } 
} 

감사합니다!

앤디

** 업데이트

나는 1.5 및 1.6 문제가 지속 안드로이드 사용하려고했습니다

.

또한, 단지 로그 캣을 확인하고, 나는 다른 어떤 파일에 대한 오류를 얻을하지 않습니다,하지만하고 .3gp을 위해 나는 아래이 오류를 얻을 : 사람에게

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 

만들기 감각을?

답변

5

와우, 때때로 나는 안드로이드 문서를 싫어한다.

필자의 경우 VideoView의 배경색을 xml로 지정했지만 동영상이로드/버퍼링되는 동안 표시되는 배경색 대신 사실상 전경색이었으며 그것의 뒤에 완벽하게 놀고 있던 비디오 위에 렌더링되고 있습니다! 롤

그래서 변화 :

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

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

에 나를 위해 치료를 작동하고 내 동영상이 지금 보여주고있다! :)

희망이 사람을 돕는다!

앤디.

관련 문제