Develop
2015.01.02 19:15
[android] 안드로이드 동영상 스트리밍 예제
조회 수 4808 댓글 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
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
873 | System/OS | [linux] 초간단 SquirrelMail 설치/설정 (다람쥐 메일) | hooni | 2017.12.11 | 4447 |
872 | System/OS | [linux] CentOS Apache Httpd에 https 적용 | hooni | 2014.03.05 | 4476 |
871 | System/OS | [linux] resolv.con 초기화 되는 문제 | hooni | 2014.04.05 | 4610 |
870 | Develop | [ios] UUID 생성 + Key Chain 연동 | hooni | 2016.05.13 | 4648 |
869 | Develop | [ios] Objective-C 프로퍼티의 strong, weak, assign | hooni | 2014.03.17 | 4680 |
868 | Develop | [ios] UITableView 특정 Row만 Update | hooni | 2014.04.08 | 4768 |
» | Develop | [android] 안드로이드 동영상 스트리밍 예제 2 | hooni | 2015.01.02 | 4808 |
866 | System/OS | [linux] CentOS 6.5 에서 "Bringing up interface eth0: Determining if ip address 121.78.127.197 is already in use for device eth0..." | hooni | 2014.04.05 | 4830 |
865 | Develop | [PHP] Mac OS에서 PHP 7 설치하기 | hooni | 2018.05.11 | 4871 |
864 | System/OS | [linux] awk 명령어 | hooni | 2014.03.11 | 4951 |
863 | Develop | [ios] Using protobuf(Protocol Buffers) on iPhone (iOS) | hooni | 2014.03.20 | 4979 |
862 | System/OS | [mac] 맥(OSX)에서 NTFS, 윈도우에서 HFS+ 사용하기 | hooni | 2014.03.12 | 5113 |