2016-11-04 4 views
3

비슷한 질문을 찾았지만 아무런 문제가 없습니다.VideoView의 URL에서 동영상 재생 [Android]

http://videocdn.bodybuilding.com/video/mp4/62000/62792m.mp4 

내 자바 코드 :

VideoView videoView= (VideoView)findViewById(R.id.videoView); 
Uri uri = Uri.parse(result.getVideoUrl()); 
exerciseVideo.setVideoURI(uri); 
exerciseVideo.requestFocus(); 
exerciseVideo.start(); 

I 앱 아무것도 실행하지

활동에 표시되고 IDE에 오류가 표시되지 않습니다 나는이 URL에서 비디오를 재생하려고합니다. 제발 제발?

편집 :

내가 비디오를 표시 할

내 활동 :

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:paddingBottom="@dimen/activity_vertical_margin" 
     android:paddingLeft="@dimen/activity_horizontal_margin" 
     android:paddingRight="@dimen/activity_horizontal_margin" 
     android:paddingTop="@dimen/activity_vertical_margin" 
     tools:context="com.example.martin.fitnessapp.ExerciseDetailActivity" 
     android:orientation="vertical"> 


     <LinearLayout 
      android:orientation="horizontal" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:weightSum="2"> 
      <ImageView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:id="@+id/exerciseImgA" 
       android:layout_weight="1" 
       android:scaleType="fitCenter" 
       android:adjustViewBounds="true" 
       android:paddingRight="8dp"/> 

      <ImageView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:id="@+id/exerciseImgB" 
       android:layout_weight="1" 
       android:scaleType="fitCenter" 
       android:adjustViewBounds="true" 
       android:paddingLeft="8dp"/> 
     </LinearLayout> 

     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:textAppearance="?android:attr/textAppearanceMedium" 
      android:text="" 
      android:id="@+id/exerciseDesc" /> 

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

     <ImageView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/guideImg" 
      android:scaleType="fitCenter" 
      android:adjustViewBounds="true"/> 


    </LinearLayout> 
</ScrollView> 
+0

logcat을 읽고 설명이 있는지 확인 했습니까? 기기가 해당 URL로 이동할 수 있음을 확인 했습니까? 세션이 보호되고 비공개가 아닌 것이 확실합니까? – JoxTraex

+0

다른 온라인 및 로컬 비디오를 하나 시도했습니다 ... 아무도 작동하지 않습니다. – Aligator

+0

브라우저에서 해당 URL로 이동하여 문제가 무엇인지 확인하십시오. 이전에 승인되지 않은 세션에서 액세스 할 수있는 올바른 URL인지 여부를 확인해야합니다. 로드하는 웹에로드가 있다고 가정하지 마십시오. 세션이 큰 차이를 만듭니다. 브라우저의 – JoxTraex

답변

13

이 코드는 나를 위해 완벽하게 작동이 코드 .. 시도 ..

final VideoView videoView; 
    videoView = (VideoView)findViewById(R.id.videoView); 
    videoView.setVideoPath("http://videocdn.bodybuilding.com/video/mp4/62000/62792m.mp4"); 
    videoView.start(); 
+0

코드를 추가해도 여전히 작동하지 않습니다./http://pastebin.com/gGej1GR0 ... 내 게시물을 편집하고 현재 레이아웃을 추가합니다. 문제를 해결하는 데 도움이 될 수 있습니다. – Aligator

1

으로 I VideoView 높이에 wrap_content을 사용해서는 안됩니다. VideoView 캐시 된 비디오 후 자체 크기가 조정되지 않았습니다.