Develop
2015.01.02 19:15
[android] 안드로이드 동영상 스트리밍 예제
조회 수 4822 댓글 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
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
261 | Algorithm | [security] RSA 암호화 설명과 예.. | hooni | 2013.04.23 | 16618 |
260 | Database | [mysql] 쿼리 로그 저장 매뉴얼 | hooni | 2013.04.23 | 15218 |
259 | System/OS | [mysql] 시간 관련 SQL구문.. | hooni | 2013.04.23 | 10775 |
258 | System/OS | [linux] 데비안(debian.org) 리눅스 명령어 예제 | hooni | 2006.04.23 | 10424 |
257 | System/OS | [linux] 꿀통(honeyd) 설치하기.. 메뉴얼 과정 6 | hooni | 2006.04.23 | 20221 |
256 | System/OS | [web] 웹서비스 취약점 자료.. (논문첨부) | hooni | 2003.04.23 | 17942 |
255 | Develop | [c++] template 사용예 | hooni | 2003.04.23 | 7149 |
254 | Develop | [c++] namespace 사용 예 | hooni | 2003.04.23 | 8656 |
253 | Develop | [asem] CMOS 패스워드 알아내기.. 소스.. | hooni | 2003.04.23 | 8696 |
252 | Develop | [c] i2osp 임시로.. ㅋㅋ | hooni | 2003.04.23 | 7821 |
251 | Develop | [c] 프로세스 정보 출력하기.. | hooni | 2003.04.23 | 6908 |
250 | Develop | [c] 심심해서.. fseek() 예제.. | hooni | 2003.04.23 | 7229 |