Develop
2015.01.02 19:15
[android] 안드로이드 동영상 스트리밍 예제
조회 수 4823 댓글 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
-
[c] 단기과정[01/14] 피보나치, 파스칼.. 파일입출력
-
[c] 단기과정[01/14] 파일 입출력
-
[c] 단기과정[01/10] 과제.. swap(any data, ..)
-
[c] 단기과정[01/08] 배열, 포인터
-
[c] 단기과정[01/08] 과제.. 파스칼 삼각형
-
[c] 단기과정[01/08] (다차원 + 배열)포인터, void 포인터
-
[c] 단기과정[01/07] 제어문, 피보나치수열
-
[c] 단기과정[01/06] sizeof, 실수표현, 메모리, 연산자
-
[c] 다중연결 서버 만들기 #4 - thread 사용
-
[c] 다중연결 서버 만들기 #3 - poll() 사용
-
[c] 다중연결 서버 만들기 #2 - select() 사용
-
[c] 다중연결 서버 만들기 #1 - fork() 사용