Develop
2015.01.02 19:15
[android] 안드로이드 동영상 스트리밍 예제
조회 수 4825 댓글 2
소스(java) 코드
import android.app.Activity; import android.net.Uri; import android.os.Bundle; import android.widget.MediaController; import android.widget.VideoView; public class main extends Activity { private static final String MOVIE_URL = "https://hooni.net/s_512kb.mp4"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.video); VideoView videoView = (VideoView) findViewById(R.id.VideoView); MediaController mediaController = new MediaController(this); mediaController.setAnchorView(videoView); // Set video link (mp4 format ) Uri video = Uri.parse(MOVIE_URL); videoView.setMediaController(mediaController); videoView.setVideoURI(video); videoView.requestFocus(); videoView.start(); } }
레이아웃(xml) 코드
<?xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/LinearLayout01" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:paddingLeft="2px" android:paddingRight="2px" android:paddingTop="2px" android:paddingBottom="2px" android:layout_width="fill_parent" android:orientation="vertical"> <VideoView android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/VideoView"> </VideoView> </LinearLayout>
[출처] http://hekamedia.egloos.com/3551068
-
[Android Error] The number of method references in a .dex file cannot exceed 64K
-
[Android] 2010년에 만들었던 세미나 자료.
-
[android] AlertDialog 메시지 창 띄우기
-
[android] Android N requires the IDE to be running with Java 1.8 or later 오류
-
[android] ArrayAdapter 테스트 파일 ㅎㅎ
-
[android] ArrayAdapter를 이용하여 출력하기
-
[android] Calling activity function from separate class
-
[android] Canvas를 이용해 이미지 확대/축소 하기
-
[android] dp, px 서로 변환
-
[android] GCM 사용하기 1 (GCM 서비스 신청하기)
-
[android] How can I place app icon on launcher home screen?
-
[android] keytool을 사용하여 키스토어 생성