Commit b4ff009f6884147048dfa327bbbeecb41cc62584

Authored by 王琳
2 parents c65901e1 c8fb9eca

Merge branch 'master' of bj.gitlab.cnlive.com:cnlive-team/CNVideoDemo

app/libs/libcnliveutil.jar
No preview for this file type
app/libs/libcnlivevideo.jar
No preview for this file type
app/src/main/java/com/cnlive/demo/video/VideoViewActivity.java
@@ -7,9 +7,6 @@ import com.cnlive.demo.video.model.ProgramVod; @@ -7,9 +7,6 @@ import com.cnlive.demo.video.model.ProgramVod;
7 import com.cnlive.libs.video.video.VideoView; 7 import com.cnlive.libs.video.video.VideoView;
8 import com.cnlive.libs.video.video.base.IMediaPlayer; 8 import com.cnlive.libs.video.video.base.IMediaPlayer;
9 9
10 -import static com.cnlive.libs.util.auth.AuthUtil.AUTH_ERROR;  
11 -import static com.cnlive.libs.util.auth.AuthUtil.AUTH_SUCCESS;  
12 -  
13 10
14 public class VideoViewActivity extends Activity { 11 public class VideoViewActivity extends Activity {
15 12
@@ -43,62 +40,24 @@ public class VideoViewActivity extends Activity { @@ -43,62 +40,24 @@ public class VideoViewActivity extends Activity {
43 private void initPlay() { 40 private void initPlay() {
44 videoView = (VideoView) findViewById(R.id.videoview); 41 videoView = (VideoView) findViewById(R.id.videoview);
45 //认证APP播放权限(使用视讯中国资源) 42 //认证APP播放权限(使用视讯中国资源)
46 - videoView.auth();  
47 - videoView.setOnBufferingUpdateListener(new IMediaPlayer.OnBufferingUpdateListener() {  
48 - @Override  
49 - public void onBufferingUpdate(IMediaPlayer mediaplayer, int percent) {  
50 - }  
51 - });  
52 - videoView.setOnPlayStateListener(new IMediaPlayer.OnPlayStateListener() {  
53 - @Override  
54 - public void onPlayState(boolean isPlay) {  
55 - }  
56 - });  
57 - videoView.setOnInfoListener(new IMediaPlayer.OnInfoListener() {  
58 - @Override  
59 - public boolean onInfo(IMediaPlayer mediaplayer, int what, int extra) {  
60 - switch (what) {  
61 - case AUTH_SUCCESS:  
62 -// auth = true;  
63 - startPlay();  
64 - break;  
65 - }  
66 - return false;  
67 - }  
68 - });  
69 - videoView.setOnErrorListener(new IMediaPlayer.OnErrorListener() {  
70 - @Override  
71 - public boolean onError(IMediaPlayer mediaplayer, int what, int extra) {  
72 - switch (what) {  
73 - case AUTH_ERROR:  
74 - break;  
75 - }  
76 - return false;  
77 - }  
78 - });  
79 videoView.setOnPreparedListener(new IMediaPlayer.OnPreparedListener() { 43 videoView.setOnPreparedListener(new IMediaPlayer.OnPreparedListener() {
80 @Override 44 @Override
81 public void onPrepared(IMediaPlayer mediaplayer) { 45 public void onPrepared(IMediaPlayer mediaplayer) {
82 mediaplayer.start(); 46 mediaplayer.start();
83 } 47 }
84 }); 48 });
85 - videoView.setOnCompletionListener(new IMediaPlayer.OnCompletionListener() {  
86 - @Override  
87 - public void onCompletion(IMediaPlayer mediaplayer) {  
88 - }  
89 - });  
90 49
91 startPlay(); 50 startPlay();
92 } 51 }
93 52
94 private void startPlay() { 53 private void startPlay() {
95 - //视讯云 直播 54 +// //视讯云 直播
96 // videoView.setDataSource(new ProgramLive(),false); 55 // videoView.setDataSource(new ProgramLive(),false);
97 56
98 //视讯云 点播 57 //视讯云 点播
99 - videoView.setDataSourceByAuth(new ProgramVod(), false); 58 + videoView.setDataSource(new ProgramVod(), false);
100 59
101 - //本地视频 60 +// //本地视频
102 // try { 61 // try {
103 // videoView.setDataSource("rtmp://live.hkstv.hk.lxdns.com/live/hks"); 62 // videoView.setDataSource("rtmp://live.hkstv.hk.lxdns.com/live/hks");
104 // } catch (IOException e) { 63 // } catch (IOException e) {
app/src/main/res/layout/activity_videoview.xml
@@ -16,9 +16,4 @@ @@ -16,9 +16,4 @@
16 android:layout_centerInParent="true" /> 16 android:layout_centerInParent="true" />
17 </RelativeLayout> 17 </RelativeLayout>
18 18
19 - <Button  
20 - android:id="@+id/switch_view"  
21 - android:layout_width="wrap_content"  
22 - android:layout_height="wrap_content"  
23 - android:onClick="onClick" />  
24 </RelativeLayout> 19 </RelativeLayout>
25 \ No newline at end of file 20 \ No newline at end of file