基本信息
源码名称:android 网络视频播放源码下载
源码大小:1.27M
文件格式:.zip
开发语言:Java
更新时间:2017-03-27
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
实现播放视频
package com.videodemoqcl;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import de.greenrobot.event.EventBus;
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer;
import fm.jiecao.jcvideoplayer_lib.VideoEvents;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
JCVideoPlayer videoController1, videoController2, videoController3;
Button btnToList, btnToListViewpager, btnToFullscreen, btnToChangecolor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/**
* 如果没有埋点需求,可以不用注册eventbus
* <br>
* if you do not want to get Buried Point , you do not need regist eventbus here
*/
EventBus.getDefault().register(this);
videoController1 = (JCVideoPlayer) findViewById(R.id.videocontroller1);
videoController1.setUp("http://2449.vod.myqcloud.com/2449_43b6f696980311e59ed467f22794e792.f20.mp4",
"http://p.qpic.cn/videoyun/0/2449_43b6f696980311e59ed467f22794e792_1/640",
"一行代码实现视频播放");
videoController2 = (JCVideoPlayer) findViewById(R.id.videocontroller2);
videoController2.setUp("http://2449.vod.myqcloud.com/2449_ded7b566b37911e5942f0b208e48548d.f20.mp4",//
"http://p.qpic.cn/videoyun/0/2449_ded7b566b37911e5942f0b208e48548d_2/640",
"一行代码实现视频播放", false);
videoController3 = (JCVideoPlayer) findViewById(R.id.videocontroller3);
videoController3.setUp("http://121.40.64.47/resource/mp3/music_yangguang3.mp3",//
"http://p.qpic.cn/videoyun/0/2449_38e65894d9e211e5b0e0a3699ca1d490_1/640",
"一行代码实现视频播放");
btnToList = (Button) findViewById(R.id.to_list_activity);
btnToListViewpager = (Button) findViewById(R.id.to_list_viewpager_activity);
btnToFullscreen = (Button) findViewById(R.id.to_fullscreen);
btnToChangecolor = (Button) findViewById(R.id.to_changecolor_activity);
btnToList.setOnClickListener(this);
btnToListViewpager.setOnClickListener(this);
btnToFullscreen.setOnClickListener(this);
btnToChangecolor.setOnClickListener(this);
}
@Override
protected void onPause() {
super.onPause();
JCVideoPlayer.releaseAllVideos();
}
public void onEventMainThread(VideoEvents event) {
if (event.type == VideoEvents.POINT_START_ICON) {
Log.i("Video Event", "POINT_START_ICON" " title is : " event.obj " url is : " event.obj1);
} else if (event.type == VideoEvents.POINT_START_THUMB) {
Log.i("Video Event", "POINT_START_THUMB" " title is : " event.obj " url is : " event.obj1);
} else if (event.type == VideoEvents.POINT_STOP) {
Log.i("Video Event", "POINT_STOP" " title is : " event.obj " url is : " event.obj1);
} else if (event.type == VideoEvents.POINT_STOP_FULLSCREEN) {
Log.i("Video Event", "POINT_STOP_FULLSCREEN" " title is : " event.obj " url is : " event.obj1);
} else if (event.type == VideoEvents.POINT_RESUME) {
Log.i("Video Event", "POINT_RESUME" " title is : " event.obj " url is : " event.obj1);
} else if (event.type == VideoEvents.POINT_RESUME_FULLSCREEN) {
Log.i("Video Event", "POINT_RESUME_FULLSCREEN" " title is : " event.obj " url is : " event.obj1);
} else if (event.type == VideoEvents.POINT_CLICK_BLANK) {
Log.i("Video Event", "POINT_CLICK_BLANK" " title is : " event.obj " url is : " event.obj1);
} else if (event.type == VideoEvents.POINT_CLICK_BLANK_FULLSCREEN) {
Log.i("Video Event", "POINT_CLICK_BLANK_FULLSCREEN" " title is : " event.obj " url is : " event.obj1);
} else if (event.type == VideoEvents.POINT_CLICK_SEEKBAR) {
Log.i("Video Event", "POINT_CLICK_SEEKBAR" " title is : " event.obj " url is : " event.obj1);
} else if (event.type == VideoEvents.POINT_CLICK_SEEKBAR_FULLSCREEN) {
Log.i("Video Event", "POINT_CLICK_SEEKBAR_FULLSCREEN" " title is : " event.obj " url is : " event.obj1);
} else if (event.type == VideoEvents.POINT_AUTO_COMPLETE) {
Log.i("Video Event", "POINT_AUTO_COMPLETE" " title is : " event.obj " url is : " event.obj1);
} else if (event.type == VideoEvents.POINT_AUTO_COMPLETE_FULLSCREEN) {
Log.i("Video Event", "POINT_AUTO_COMPLETE_FULLSCREEN" " title is : " event.obj " url is : " event.obj1);
} else if (event.type == VideoEvents.POINT_ENTER_FULLSCREEN) {
Log.i("Video Event", "POINT_ENTER_FULLSCREEN" " title is : " event.obj " url is : " event.obj1);
} else if (event.type == VideoEvents.POINT_QUIT_FULLSCREEN) {
Log.i("Video Event", "POINT_QUIT_FULLSCREEN" " title is : " event.obj " url is : " event.obj1);
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.to_list_activity:
startActivity(new Intent(MainActivity.this, ListActivity.class));
break;
case R.id.to_list_viewpager_activity:
startActivity(new Intent(MainActivity.this, ListViewpagerActivity.class));
break;
case R.id.to_fullscreen://进入全屏播放
JCVideoPlayer.toFullscreenActivity(this,
"http://2449.vod.myqcloud.com/2449_43b6f696980311e59ed467f22794e792.f20.mp4",
"http://p.qpic.cn/videoyun/0/2449_43b6f696980311e59ed467f22794e792_1/640",
"一行代码实现视频播放");
break;
case R.id.to_changecolor_activity:
startActivity(new Intent(this, SetSkinActivity.class));
break;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
}