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
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
793 | Develop | [jsp][php] 간단한 강좌 자료.. | hooni | 2003.04.23 | 8109 |
792 | Develop | [c] 학생명단 관리 프로그램 소스 ㅋㅋ 1 | hooni | 2003.04.23 | 7771 |
791 | Develop | [c] 근의 공식으로 2차방정식 풀기.. | hooni | 2003.04.23 | 7775 |
790 | Develop | [c] 이진트리(binary tree)의 운행.. | hooni | 2003.04.23 | 8268 |
789 | Develop | [c] 이진트리(binary tree)의 특성 | hooni | 2003.04.23 | 9608 |
788 | Develop | [자료구조] 트리(tree) 용어정리 | hooni | 2003.04.23 | 11067 |
787 | Develop | [c] 농구팀 점수 산출 프로그램 소스 | hooni | 2003.04.23 | 7383 |
786 | Develop | [c] 단어 입력/수정 프로그램 소스 | hooni | 2003.04.23 | 7026 |
785 | Develop | [c] 정사각배열의 서브 배열의 최대 값 구하기 | hooni | 2003.04.23 | 7022 |
784 | Develop | [c] 이진트리(binary tree) 샘플소스 (삽입, 삭제, 운행) | hooni | 2003.04.23 | 7807 |
783 | Develop | [java] 컴포넌트 배치 ㅡ.,ㅡ; | hooni | 2003.04.23 | 7154 |
782 | Develop | [html] 메타태그 사용예.. 은지나 바라~ | hooni | 2003.04.23 | 7234 |