Develop
2015.01.02 19:15
[android] 안드로이드 동영상 스트리밍 예제
Views 4913 Comment 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
No. | Category | Subject | Author | Date | Views |
---|---|---|---|---|---|
217 | Develop | [js] jQuery 코드 작성시 편리한 HTML 템플릿 | hooni | 2013.12.17 | 33111 |
216 | Develop | [js] jQuery, Javascript 모바일(스마트폰) 판단하는 방법 | hooni | 2015.04.26 | 2556 |
215 | Develop | [js] JSON 컨트롤.. 재귀호출로 값 출력하기 | hooni | 2013.04.23 | 28668 |
214 | Develop | [js] One Time Pad key generatorㅡ.,ㅡ; | hooni | 2013.04.23 | 6807 |
213 | Develop | [js] php의 number_format() 함수와 같은.. ㅋㅋ | hooni | 2013.04.23 | 6944 |
212 | Develop | [js] selectbox 선택 후 input 박스에 적용 | hooni | 2013.04.23 | 8340 |
211 | Develop | [js] show/hide 이벤트 감시 (Observing show/hide event) | hooni | 2021.02.03 | 2759 |
210 | Develop | [js] Text 값을 클립보드에 복사하기 | hooni | 2020.10.10 | 783 |
209 | Develop | [js] Text 중 URL 형식을 인식해 단축 URL로 변경 | hooni | 2013.04.23 | 8723 |
208 | Develop | [js] URL 파싱하기 (jQuery 안쓰고) | hooni | 2017.12.14 | 1434 |
207 | Develop | [js] window.open() 속성 사용 방법 | hooni | 2013.11.18 | 13630 |
206 | Develop | [js] 가운데 새창 뜨는 함수와 이벤트 | hooni | 2003.04.23 | 6742 |