Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
android
/
dayu
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f88e6950
authored
4 years ago
by
mReturn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
直播调试
parent
b8338b29
master
…
dev
dev_xx
dev_xx_241116
dev_xx_250108_toast
dev_xx_250224_report
dev_xx_web
v2.7.2
v2.7.1
v2.7.0
v2.6.9
v2.6.7
v2.6.6
v2.6.5
v2.6.4
v2.6.3
v2.6.2
v2.6.1
v2.6.0
v2.5.9
v2.5.7
dev20230405
Hide whitespace changes
Inline
Side-by-side
Showing
51 changed files
with
753 additions
and
245 deletions
app/src/main/java/com/dayu/bigfish/ui/MainActivity.java
baseSDK/src/main/java/com/dayu/base/api/APIService.java
baseSDK/src/main/java/com/dayu/base/api/BaseApiFactory.java
baseSDK/src/main/java/com/dayu/common/Constants.java
baseSDK/src/main/java/com/dayu/event/UserInfo.java
baseSDK/src/main/java/com/dayu/utils/AppUtils.java
baseSDK/src/main/java/com/dayu/utils/CommonUtils.java
baseSDK/src/main/java/com/dayu/utils/MediaChooseUtils.java
baseSDK/src/main/java/com/dayu/widgets/MyJzvdStd.java
baseSDK/src/main/res/values/strings.xml
build.gradle
learnCenter/src/main/java/com/dayu/learncenter/api/LearnService.java
learnCenter/src/main/java/com/dayu/learncenter/api/bean/LearnTabBean.java
learnCenter/src/main/java/com/dayu/learncenter/api/bean/LiveVideosBean.java → learnCenter/src/main/java/com/dayu/learncenter/api/bean/LiveBackVideosBean.java
learnCenter/src/main/java/com/dayu/learncenter/api/data/LiveData.java
learnCenter/src/main/java/com/dayu/learncenter/ui/activity/CourseDetailActivity.java
learnCenter/src/main/java/com/dayu/learncenter/ui/activity/PrepareLiveActivity.java
learnCenter/src/main/java/com/dayu/learncenter/ui/activity/VideoPlayActivity.java
learnCenter/src/main/java/com/dayu/learncenter/ui/fragment/CommonLearnFragment.java
learnCenter/src/main/java/com/dayu/learncenter/ui/fragment/HomeLearnFragment.java
learnCenter/src/main/java/com/dayu/learncenter/ui/fragment/LiveListFragment.java
learnCenter/src/main/release/AndroidManifest.xml
learnCenter/src/main/res/layout/activity_course_detail.xml
learnCenter/src/main/res/layout/activity_prepare_live.xml
learnCenter/src/main/res/layout/activity_video_play.xml
learnCenter/src/main/res/layout/item_live_play_back.xml
learnCenter/src/main/res/layout/item_video_live.xml
liveModule/src/main/java/com/dayu/livemodule/LiveUtils.java
liveModule/src/main/java/com/dayu/livemodule/MLVBLiveRoom.java
liveModule/src/main/java/com/dayu/livemodule/MLVBLiveRoomImpl.java
liveModule/src/main/java/com/dayu/livemodule/event/LiveFinishEvent.java
liveModule/src/main/java/com/dayu/livemodule/StartPushEvent.java → liveModule/src/main/java/com/dayu/livemodule/event/StartPushEvent.java
liveModule/src/main/java/com/dayu/livemodule/event/UserKickOutEvent.java
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/TCGlobalConfig.java
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/anchor/TCBaseAnchorActivity.java
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/anchor/music/TCAudioControl.java
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/audience/TCAudienceActivity.java
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/common/utils/TCConstants.java
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/common/utils/TCUtils.java
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/common/widget/TCInputTextMsgDialog.java
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/common/widget/TCUserAvatarListAdapter.java
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/main/videolist/utils/TCVideoInfo.java
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/main/videolist/utils/TCVideoListMgr.java
liveModule/src/main/res/layout/activity_audience.xml
liveModule/src/main/res/layout/activity_camera_anchor.xml
liveModule/src/main/res/values/strings.xml
liveModule/src/main/res/values/styles.xml
provider/src/main/java/com/dayu/provider/router/RouterPath.java
userCenter/src/main/java/com/dayu/usercenter/data/protocol/EngineerInfo.java
userCenter/src/main/java/com/dayu/usercenter/ui/fragment/HomeUserFragment.java
userCenter/src/main/res/layout/fragment_home_user.xml
app/src/main/java/com/dayu/bigfish/ui/MainActivity.java
View file @
f88e6950
...
...
@@ -103,6 +103,7 @@ public class MainActivity extends BaseActivity<MainPresenter, ActivityMainBindin
@Override
public
void
initView
()
{
LiveUtils
.
initEnv
(
Constants
.
ENVIROMENT
);
if
(
getIntent
().
hasExtra
(
Constants
.
ORDER_ID
))
{
Bundle
bundle
=
new
Bundle
();
bundle
.
putInt
(
Constants
.
ORDER_ID
,
Integer
.
parseInt
(
getIntent
().
getStringExtra
(
Constants
.
ORDER_ID
)));
...
...
This diff is collapsed.
Click to expand it.
baseSDK/src/main/java/com/dayu/base/api/APIService.java
View file @
f88e6950
...
...
@@ -49,6 +49,17 @@ public interface APIService {
@POST
(
Constants
.
UP_PHOTO
)
Observable
<
BaseResponse
<
List
<
String
>>>
uploadPhoto
(
@Part
MultipartBody
.
Part
part
);
/**
* 上传图片单张.
*
* @param part
* @param style nowatermark 无水印
* @return
*/
@Multipart
@POST
(
Constants
.
UP_PHOTO
)
Observable
<
BaseResponse
<
List
<
String
>>>
uploadPhoto
(
@Part
MultipartBody
.
Part
part
,
@Query
(
"style"
)
String
style
);
/**
* 上传单个视频.
...
...
This diff is collapsed.
Click to expand it.
baseSDK/src/main/java/com/dayu/base/api/BaseApiFactory.java
View file @
f88e6950
...
...
@@ -23,6 +23,9 @@ public class BaseApiFactory {
public
static
Observable
<
List
<
String
>>
uploadPhoto
(
MultipartBody
.
Part
part
)
{
return
Api
.
getService
(
APIService
.
class
).
uploadPhoto
(
part
).
compose
(
Api
.
applySchedulers
());
}
public
static
Observable
<
List
<
String
>>
uploadPhoto
(
MultipartBody
.
Part
part
,
String
style
)
{
return
Api
.
getService
(
APIService
.
class
).
uploadPhoto
(
part
,
style
).
compose
(
Api
.
applySchedulers
());
}
public
static
Observable
<
String
>
uploadVideo
(
MultipartBody
.
Part
part
)
{
return
Api
.
getService
(
APIService
.
class
).
uploadVideo
(
part
).
compose
(
Api
.
applySchedulers
());
...
...
This diff is collapsed.
Click to expand it.
baseSDK/src/main/java/com/dayu/common/Constants.java
View file @
f88e6950
...
...
@@ -32,40 +32,42 @@ public class Constants {
public
static
final
String
PROGRAM_PATH
=
"pages/mallDetail/main?goodsId=gid&userId=uid&type=1"
;
//小程序路径
public
static
final
String
INVITE_NEW_SHARE_URL
=
"http://app.dl.kf.ai/ext/#/shareMaster?code="
;
//邀请新人分享链接
public
static
final
String
INVITE_NEW_SHARE_URL_BUSINESS
=
"http://app.dl.kf.ai/ext/#/merchants?code="
;
//邀请商家分享链接
// public static String VIDEO_SHARE_URL = "http://app.dl.kf.ai/ext/#/shareVideo?type=_type&id="; //学习视频分享链接 type(课程: course 直播: live)
public
static
String
VIDEO_SHARE_URL
=
"http://uat.kf.ai:9099/#/shareVideo?type=_type&id="
;
//uat 学习视频分享链接 type(课程: course 直播: live)
/**
* dev环境配置.
*/
public
static
String
ENVIROMENT
=
"debug"
;
public
static
final
int
LOG_LEVEL
=
LogUtils
.
LEVEL_ALL
;
public
static
String
BASE_URL
=
"http://47.94.101.239:3112"
;
public
static
String
WEB_SOP
=
"http://47.94.101.239:9004/#/sop"
;
public
static
String
CHECK_MULTI_WEB_SOP
=
"http://47.94.101.239:9004/#/manyServiceResult"
;
public
static
String
MULTI_WEB_SOP
=
"http://47.94.101.239:9004/#/manySop"
;
public
static
String
WEB_SOP_DETAIL
=
"http://47.94.101.239:9004/#/sopdetail"
;
public
static
String
WEB_ZHI_SHI
=
"http://47.94.101.239:9004/#/detail"
;
public
static
final
String
UP_PHOTO
=
"/file/uploadMore?targetPath=test/sp/mobile/android/business/checkApply"
;
public
static
final
String
UP_VIDEO
=
"/file/uploadVideoOne?targetPath=dev/video"
;
public
static
final
boolean
IS_DEBUG
=
true
;
public
static
final
boolean
CAN_CHANGE_ENV
=
true
;
//是否显示切换开发环境菜单
//
public static String ENVIROMENT = "debug";
//
public static final int LOG_LEVEL = LogUtils.LEVEL_ALL;
//
public static String BASE_URL = "http://47.94.101.239:3112";
//
public static String WEB_SOP = "http://47.94.101.239:9004/#/sop";
//
public static String CHECK_MULTI_WEB_SOP = "http://47.94.101.239:9004/#/manyServiceResult";
//
public static String MULTI_WEB_SOP = "http://47.94.101.239:9004/#/manySop";
//
public static String WEB_SOP_DETAIL = "http://47.94.101.239:9004/#/sopdetail";
//
public static String WEB_ZHI_SHI = "http://47.94.101.239:9004/#/detail";
//
public static final String UP_PHOTO = "/file/uploadMore?targetPath=test/sp/mobile/android/business/checkApply";
//
public static final String UP_VIDEO = "/file/uploadVideoOne?targetPath=dev/video";
//
public static final boolean IS_DEBUG = true;
//
public static final boolean CAN_CHANGE_ENV = true; //是否显示切换开发环境菜单
/**
* uat测试环境配置.
*/
//
public static String ENVIROMENT = "uat";
//
public static int LOG_LEVEL = LogUtils.LEVEL_ALL;
//
public static String BASE_URL = "http://47.95.223.6:3112";
//
public static String WEB_SOP = "http://47.95.223.6:9004/#/sop";
//
public static String WEB_SOP_DETAIL = "http://47.95.223.6:9004/#/sopdetail";
//
public static String WEB_ZHI_SHI = "http://47.95.223.6:9004/#/detail";
//
public static String CHECK_MULTI_WEB_SOP = "http://47.95.223.6:9004/#/manyServiceResult";
//
public static String MULTI_WEB_SOP = "http://47.95.223.6:9004/#/manySop";
//
public static final String UP_PHOTO = "/file/uploadMore?targetPath=test/sp/mobile/android/business/checkApply";
//
public static final String UP_VIDEO = "/file/uploadVideoOne?targetPath=test/video";
//
public static final boolean IS_DEBUG = true;
//
public static final boolean CAN_CHANGE_ENV = false; //是否显示切换开发环境菜单
public
static
String
ENVIROMENT
=
"uat"
;
public
static
int
LOG_LEVEL
=
LogUtils
.
LEVEL_ALL
;
public
static
String
BASE_URL
=
"http://47.95.223.6:3112"
;
public
static
String
WEB_SOP
=
"http://47.95.223.6:9004/#/sop"
;
public
static
String
WEB_SOP_DETAIL
=
"http://47.95.223.6:9004/#/sopdetail"
;
public
static
String
WEB_ZHI_SHI
=
"http://47.95.223.6:9004/#/detail"
;
public
static
String
CHECK_MULTI_WEB_SOP
=
"http://47.95.223.6:9004/#/manyServiceResult"
;
public
static
String
MULTI_WEB_SOP
=
"http://47.95.223.6:9004/#/manySop"
;
public
static
final
String
UP_PHOTO
=
"/file/uploadMore?targetPath=test/sp/mobile/android/business/checkApply"
;
public
static
final
String
UP_VIDEO
=
"/file/uploadVideoOne?targetPath=test/video"
;
public
static
final
boolean
IS_DEBUG
=
true
;
public
static
final
boolean
CAN_CHANGE_ENV
=
false
;
//是否显示切换开发环境菜单
/**
* 正式环境.
...
...
This diff is collapsed.
Click to expand it.
baseSDK/src/main/java/com/dayu/event/UserInfo.java
View file @
f88e6950
...
...
@@ -37,6 +37,16 @@ public class UserInfo {
private
List
<
Integer
>
roles
;
private
String
mobile
;
private
int
liveStatus
;
//1.开启主播权限
public
int
getLiveStatus
()
{
return
liveStatus
;
}
public
void
setLiveStatus
(
int
liveStatus
)
{
this
.
liveStatus
=
liveStatus
;
}
//不为空时弹出邀请码弹框
private
String
newAccount
;
...
...
This diff is collapsed.
Click to expand it.
baseSDK/src/main/java/com/dayu/utils/AppUtils.java
View file @
f88e6950
...
...
@@ -5,10 +5,8 @@ import android.content.pm.PackageInfo;
import
android.content.pm.PackageManager
;
import
android.telephony.TelephonyManager
;
import
com.alibaba.android.arouter.launcher.ARouter
;
import
com.dayu.baselibrary.R
;
import
com.dayu.common.BaseApplication
;
import
com.dayu.common.BaseConstant
;
import
com.dayu.common.Constants
;
import
com.hyphenate.chat.EMClient
;
...
...
This diff is collapsed.
Click to expand it.
baseSDK/src/main/java/com/dayu/utils/CommonUtils.java
View file @
f88e6950
...
...
@@ -283,11 +283,10 @@ public class CommonUtils {
UMWeb
web
=
new
UMWeb
(
url
);
web
.
setTitle
(
title
);
if
(
TextUtils
.
isEmpty
(
imgUrl
))
{
web
.
setThumb
(
new
UMImage
(
activity
,
R
.
drawable
.
icon_app_logo
));
web
.
setThumb
(
new
UMImage
(
activity
,
Constants
.
AppLogoUrl
));
}
else
{
web
.
setThumb
(
new
UMImage
(
activity
,
imgUrl
));
}
web
.
setThumb
(
new
UMImage
(
activity
,
imgUrl
));
web
.
setDescription
(
description
);
new
ShareAction
(
activity
).
withMedia
(
web
)
.
setDisplayList
(
SHARE_MEDIA
.
WEIXIN
,
SHARE_MEDIA
.
WEIXIN_CIRCLE
)
...
...
This diff is collapsed.
Click to expand it.
baseSDK/src/main/java/com/dayu/utils/MediaChooseUtils.java
View file @
f88e6950
...
...
@@ -19,10 +19,10 @@ public class MediaChooseUtils {
public
static
void
chooseSigleImg
(
Activity
activity
)
{
chooseMedia
(
activity
,
PictureMimeType
.
ofImage
(),
1
,
0
);
}
public
static
void
choose
CropSigl
eImg
(
Activity
activity
)
{
public
static
void
choose
Liv
eImg
(
Activity
activity
)
{
PictureSelectionModel
selector
=
getPictureSelectionModel
(
activity
,
PictureMimeType
.
ofImage
(),
1
,
0
);
selector
.
enableCrop
(
true
)
//是否裁剪
.
withAspectRatio
(
1
,
1
)
.
withAspectRatio
(
3
,
2
)
.
freeStyleCropEnabled
(
true
);
selector
.
forResult
(
PictureConfig
.
CHOOSE_REQUEST
);
}
...
...
This diff is collapsed.
Click to expand it.
baseSDK/src/main/java/com/dayu/widgets/MyJzvdStd.java
View file @
f88e6950
...
...
@@ -2,7 +2,6 @@ package com.dayu.widgets;
import
android.content.Context
;
import
android.util.AttributeSet
;
import
android.util.Log
;
import
com.dayu.baselibrary.R
;
import
com.dayu.utils.ToastUtils
;
...
...
@@ -13,6 +12,7 @@ public class MyJzvdStd extends JzvdStd {
public
int
curProgress
;
public
long
curPosition
;
private
PlayCallBack
callBack
;
private
startPlayCallBack
startPlayCallBack
;
public
MyJzvdStd
(
Context
context
)
{
super
(
context
);
...
...
@@ -34,6 +34,8 @@ public class MyJzvdStd extends JzvdStd {
curPosition
=
0
;
if
(
callBack
!=
null
)
callBack
.
onstart
();
if
(
startPlayCallBack
!=
null
)
startPlayCallBack
.
onstart
();
}
//onState 代表了播放器引擎的回调,播放视频各个过程的状态的回调
...
...
@@ -111,6 +113,9 @@ public class MyJzvdStd extends JzvdStd {
public
void
setPlayCallBack
(
PlayCallBack
callBack
)
{
this
.
callBack
=
callBack
;
}
public
void
setStartCallBack
(
startPlayCallBack
callBack
)
{
this
.
startPlayCallBack
=
callBack
;
}
public
interface
PlayCallBack
{
void
onstart
();
...
...
@@ -121,4 +126,7 @@ public class MyJzvdStd extends JzvdStd {
void
onComplete
();
}
public
interface
startPlayCallBack
{
void
onstart
();
}
}
This diff is collapsed.
Click to expand it.
baseSDK/src/main/res/values/strings.xml
View file @
f88e6950
...
...
@@ -995,9 +995,9 @@ C) 在甲方使用大鱼平台服务过程中产生的业务数据,客户数
<string
name=
"find_course"
>
查找课程
</string>
<array
name=
"learn_top_tab_item"
>
<item>
公开课
</item>
<item>
直播
</item>
<item>
已学习
</item>
<item>
已发布
</item>
<item>
直播
</item>
</array>
<string
name=
"pub_course_title"
>
我要开课
</string>
<string
name=
"course_theme"
>
课程主题:
</string>
...
...
This diff is collapsed.
Click to expand it.
build.gradle
View file @
f88e6950
...
...
@@ -5,8 +5,8 @@ buildscript {
ext
.
build_tools_version
=
"27.0.3"
ext
.
min_sdk_version
=
17
ext
.
target_sdk_version
=
26
ext
.
version_code
=
25
5
ext
.
verson_name
=
"2.5.
5
"
ext
.
version_code
=
25
7
ext
.
verson_name
=
"2.5.
7
"
ext
.
gradle_version
=
'3.1.4'
ext
.
isReleaseMinify
=
false
ext
.
isDebugMinify
=
false
...
...
This diff is collapsed.
Click to expand it.
learnCenter/src/main/java/com/dayu/learncenter/api/LearnService.java
View file @
f88e6950
...
...
@@ -9,7 +9,7 @@ import com.dayu.common.Constants;
import
com.dayu.learncenter.api.bean.CommonLearnBean
;
import
com.dayu.learncenter.api.bean.CourseDeatilBean
;
import
com.dayu.learncenter.api.bean.LearnTabBean
;
import
com.dayu.learncenter.api.bean.LiveVideosBean
;
import
com.dayu.learncenter.api.bean.Live
Back
VideosBean
;
import
com.dayu.learncenter.api.data.EditCourseData
;
import
com.dayu.learncenter.api.data.LiveData
;
import
com.dayu.learncenter.api.data.PubCourseData
;
...
...
@@ -105,13 +105,14 @@ public interface LearnService {
/**
* 课程 点赞/取消点赞
*
* @param type 1点赞 2取消点赞
* @return
*/
@GET
(
Constants
.
API_7900
+
"/courses/point/courseId/{courseId}/engineerId/{engineerId}/type/{type}"
)
Observable
<
BaseResponse
<
Boolean
>>
pointCourse
(
@Path
(
"courseId"
)
int
courseId
,
@Path
(
"engineerId"
)
int
engineerId
,
@Path
(
"type"
)
int
type
);
@Path
(
"engineerId"
)
int
engineerId
,
@Path
(
"type"
)
int
type
);
/**
...
...
@@ -129,6 +130,7 @@ public interface LearnService {
*/
@POST
(
Constants
.
API_7400
+
"/leaveMessage/courses/engineer"
)
Observable
<
BaseResponse
<
Boolean
>>
addComment
(
@Body
CommentPostData
data
);
/**
* 回复
*/
...
...
@@ -144,15 +146,34 @@ public interface LearnService {
/**
* 获取直播视频列表
* @param liveStatus 1.直播中 2.已停止
* @param status 1.正常 2.删除
* @param liveStreamType 1.主播 2.连麦
*
* @param liveStatus 1.直播中 2.已停止
* @param status 1.正常 2.删除
* @param liveStreamType 1.主播 2.连麦
* @return
*/
@GET
(
Constants
.
API_7900
+
"/live"
)
Observable
<
BaseResponse
<
BasePageBean
<
LiveVideosBean
>>>
getLiveVideos
(
@Query
(
"liveStatus"
)
int
liveStatus
,
@Query
(
"status"
)
int
status
,
@Query
(
"liveStreamType"
)
int
liveStreamType
,
@Query
(
"page"
)
int
page
,
@Query
(
"pageSize"
)
int
pageSize
);
@GET
(
Constants
.
API_7900
+
"/live/all"
)
Observable
<
BaseResponse
<
BasePageBean
<
LiveBackVideosBean
>>>
getLiveVideos
(
@Query
(
"engineerId"
)
int
engineerId
,
@Query
(
"liveStatus"
)
int
liveStatus
,
@Query
(
"status"
)
int
status
,
@Query
(
"liveStreamType"
)
int
liveStreamType
,
@Query
(
"isNullVideUrl"
)
int
isNullVideUrl
,
@Query
(
"page"
)
int
page
,
@Query
(
"pageSize"
)
int
pageSize
);
/**
* 回放视频点赞
*
* @param type 点赞:1 取消点赞:2
*/
@GET
(
Constants
.
API_7900
+
"/live/point/liveId/{liveId}/engineerId/{engineerId}/type/{type}"
)
Observable
<
BaseResponse
<
Boolean
>>
pointBackVideo
(
@Path
(
"liveId"
)
int
liveId
,
@Path
(
"engineerId"
)
int
engineerId
,
@Path
(
"type"
)
int
type
);
/**
* 回放视频观看
*/
@GET
(
Constants
.
API_7900
+
"/live/watcher/{liveId}"
)
Observable
<
BaseResponse
<
Boolean
>>
playBackVideo
(
@Path
(
"liveId"
)
int
liveId
);
}
This diff is collapsed.
Click to expand it.
learnCenter/src/main/java/com/dayu/learncenter/api/bean/LearnTabBean.java
View file @
f88e6950
...
...
@@ -11,6 +11,15 @@ public class LearnTabBean {
private
int
leaners
;
private
int
publishes
;
private
int
totalCourses
;
private
int
lives
;
public
int
getLives
()
{
return
lives
;
}
public
void
setLives
(
int
lives
)
{
this
.
lives
=
lives
;
}
public
int
getLeaners
()
{
return
leaners
;
...
...
This diff is collapsed.
Click to expand it.
learnCenter/src/main/java/com/dayu/learncenter/api/bean/LiveVideosBean.java
→
learnCenter/src/main/java/com/dayu/learncenter/api/bean/Live
Back
VideosBean.java
View file @
f88e6950
package
com
.
dayu
.
learncenter
.
api
.
bean
;
public
class
LiveVideosBean
{
import
java.io.Serializable
;
public
class
LiveBackVideosBean
implements
Serializable
{
/**
* id : 33
...
...
@@ -35,7 +37,7 @@ public class LiveVideosBean {
private
String
endTime
;
private
String
createTime
;
private
String
created
;
private
Objec
t
watchNum
;
private
in
t
watchNum
;
private
int
playBackNum
;
private
Object
msgNum
;
private
int
pointNum
;
...
...
@@ -50,7 +52,16 @@ public class LiveVideosBean {
private
int
status
;
private
int
liveErrCode
;
private
String
liveErrMsg
;
private
Object
liveStreamPic
;
private
String
liveStreamPic
;
private
int
pointStatus
;
public
int
getPointStatus
()
{
return
pointStatus
;
}
public
void
setPointStatus
(
int
pointStatus
)
{
this
.
pointStatus
=
pointStatus
;
}
public
int
getId
()
{
return
id
;
...
...
@@ -108,11 +119,11 @@ public class LiveVideosBean {
this
.
created
=
created
;
}
public
Objec
t
getWatchNum
()
{
public
in
t
getWatchNum
()
{
return
watchNum
;
}
public
void
setWatchNum
(
Objec
t
watchNum
)
{
public
void
setWatchNum
(
in
t
watchNum
)
{
this
.
watchNum
=
watchNum
;
}
...
...
@@ -228,11 +239,11 @@ public class LiveVideosBean {
this
.
liveErrMsg
=
liveErrMsg
;
}
public
Object
getLiveStreamPic
()
{
public
String
getLiveStreamPic
()
{
return
liveStreamPic
;
}
public
void
setLiveStreamPic
(
Object
liveStreamPic
)
{
public
void
setLiveStreamPic
(
String
liveStreamPic
)
{
this
.
liveStreamPic
=
liveStreamPic
;
}
}
This diff is collapsed.
Click to expand it.
learnCenter/src/main/java/com/dayu/learncenter/api/data/LiveData.java
View file @
f88e6950
...
...
@@ -3,6 +3,9 @@ package com.dayu.learncenter.api.data;
public
class
LiveData
{
public
int
liveStreamType
;
public
String
pushUrl
;
public
String
title
;
public
String
liveStreamPic
;
public
LiveData
(
int
liveStreamType
,
String
pushUrl
)
{
this
.
liveStreamType
=
liveStreamType
;
...
...
This diff is collapsed.
Click to expand it.
learnCenter/src/main/java/com/dayu/learncenter/ui/activity/CourseDetailActivity.java
View file @
f88e6950
package
com
.
dayu
.
learncenter
.
ui
.
activity
;
import
android.annotation.SuppressLint
;
import
android.content.Intent
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.text.TextUtils
;
import
android.view.View
;
...
...
@@ -25,6 +26,7 @@ import com.dayu.widgets.JZMediaIjk;
import
com.dayu.widgets.KeyboardStateObserver
;
import
com.dayu.widgets.MyJzvdStd
;
import
com.umeng.analytics.MobclickAgent
;
import
com.umeng.socialize.UMShareAPI
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -61,6 +63,7 @@ public class CourseDetailActivity extends BaseActivity<SImplePresenter, Activity
initUser
();
mBind
.
titleBack
.
setOnClickListener
(
v
->
dumpBack
());
mBind
.
ivLike
.
setOnClickListener
(
v
->
pointVideo
());
mBind
.
ibShare
.
setOnClickListener
(
v
->
shareVideo
());
courseId
=
getBundle
().
getInt
(
Constants
.
ID
,
0
);
showDialog
();
initData
();
...
...
@@ -304,4 +307,17 @@ public class CourseDetailActivity extends BaseActivity<SImplePresenter, Activity
super
.
onBackPressed
();
}
}
public
void
shareVideo
()
{
if
(
courseDetail
!=
null
){
String
url
=
Constants
.
VIDEO_SHARE_URL
.
replace
(
"_type"
,
"course"
)+
courseDetail
.
getId
();
CommonUtils
.
shareWxUrl
(
mActivity
,
url
,
""
,
courseDetail
.
getName
(),
courseDetail
.
getBrief
(),
null
);
}
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
Intent
data
)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
UMShareAPI
.
get
(
this
).
onActivityResult
(
requestCode
,
resultCode
,
data
);
}
}
This diff is collapsed.
Click to expand it.
learnCenter/src/main/java/com/dayu/learncenter/ui/activity/PrepareLiveActivity.java
View file @
f88e6950
...
...
@@ -2,10 +2,8 @@ package com.dayu.learncenter.ui.activity;
import
android.content.Intent
;
import
android.text.TextUtils
;
import
android.view.View
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.RequestManager
;
import
com.alibaba.android.arouter.facade.annotation.Route
;
import
com.dayu.base.api.BaseApiFactory
;
import
com.dayu.base.ui.activity.BaseActivity
;
import
com.dayu.base.ui.presenter.SImplePresenter
;
...
...
@@ -14,6 +12,8 @@ import com.dayu.learncenter.databinding.ActivityPrepareLiveBinding;
import
com.dayu.livemodule.xiaozhibo.anchor.TCCameraAnchorActivity
;
import
com.dayu.livemodule.xiaozhibo.common.utils.TCConstants
;
import
com.dayu.livemodule.xiaozhibo.login.TCUserMgr
;
import
com.dayu.provider.router.RouterPath
;
import
com.dayu.utils.GlideImageLoader
;
import
com.dayu.utils.MediaChooseUtils
;
import
com.luck.picture.lib.PictureSelector
;
import
com.luck.picture.lib.config.PictureConfig
;
...
...
@@ -26,6 +26,7 @@ import okhttp3.MediaType;
import
okhttp3.MultipartBody
;
import
okhttp3.RequestBody
;
@Route
(
path
=
RouterPath
.
PATH_PREPARELIVE
)
public
class
PrepareLiveActivity
extends
BaseActivity
<
SImplePresenter
,
ActivityPrepareLiveBinding
>
{
String
title
;
...
...
@@ -44,13 +45,15 @@ public class PrepareLiveActivity extends BaseActivity<SImplePresenter, ActivityP
public
void
initView
()
{
mBind
.
titleBack
.
setOnClickListener
(
view
->
dumpBack
());
mBind
.
ivCover
.
setOnClickListener
(
view
->
{
MediaChooseUtils
.
choose
CropSigl
eImg
(
this
);
MediaChooseUtils
.
choose
Liv
eImg
(
this
);
});
mBind
.
btnConfirm
.
setOnClickListener
(
v
->{
title
=
mBind
.
edtTitle
.
getText
().
toString
().
trim
();
if
(
TextUtils
.
isEmpty
(
title
)){
if
(
TextUtils
.
isEmpty
(
TCUserMgr
.
getInstance
().
getCoverPic
())){
showToast
(
"请上传封面"
);
}
else
if
(
TextUtils
.
isEmpty
(
title
)){
showToast
(
"请输入标题"
);
}
else
{
}
else
{
startPublish
();
}
});
...
...
@@ -64,9 +67,8 @@ public class PrepareLiveActivity extends BaseActivity<SImplePresenter, ActivityP
private
void
initCover
()
{
String
strCover
=
TCUserMgr
.
getInstance
().
getCoverPic
();
if
(!
TextUtils
.
isEmpty
(
strCover
))
{
RequestManager
req
=
Glide
.
with
(
this
);
req
.
load
(
strCover
).
into
(
mBind
.
ivCover
);
mBind
.
tvTips
.
setVisibility
(
View
.
GONE
);
GlideImageLoader
.
load
(
this
,
mBind
.
ivCover
,
strCover
,
R
.
drawable
.
publish_background
);
// mBind.tvTips.setVisibility(View.GONE);
}
else
{
mBind
.
ivCover
.
setImageResource
(
com
.
dayu
.
livemodule
.
R
.
drawable
.
publish_background
);
}
...
...
@@ -79,10 +81,10 @@ public class PrepareLiveActivity extends BaseActivity<SImplePresenter, ActivityP
switch
(
requestCode
)
{
case
PictureConfig
.
CHOOSE_REQUEST
:
List
<
LocalMedia
>
mSelectList
=
PictureSelector
.
obtainMultipleResult
(
data
);
if
(
mSelectList
!=
null
)
{
for
(
int
a
=
0
;
a
<
mSelectList
.
size
();
a
++)
{
uploadPic
(
mSelectList
.
get
(
a
).
getCutPath
()
);
}
if
(
mSelectList
!=
null
&&
mSelectList
.
size
()>
0
)
{
uploadPic
(
mSelectList
.
get
(
0
).
getCutPath
());
// TCUserMgr.getInstance().setCoverPic(mSelectList.get(0).getCutPath(), null
);
// initCover();
}
break
;
}
...
...
@@ -95,7 +97,7 @@ public class PrepareLiveActivity extends BaseActivity<SImplePresenter, ActivityP
RequestBody
requestFile
=
RequestBody
.
create
(
MediaType
.
parse
(
"multipart/form-data"
),
file
);
MultipartBody
.
Part
body
=
MultipartBody
.
Part
.
createFormData
(
"fileUpload"
,
file
.
getName
(),
requestFile
);
showDialog
();
BaseApiFactory
.
uploadPhoto
(
body
).
subscribe
(
mPresenter
.
baseObserver
(
list
->
{
BaseApiFactory
.
uploadPhoto
(
body
,
"nowatermark"
).
subscribe
(
mPresenter
.
baseObserver
(
list
->
{
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
TCUserMgr
.
getInstance
().
setCoverPic
(
list
.
get
(
0
),
null
);
initCover
();
...
...
This diff is collapsed.
Click to expand it.
learnCenter/src/main/java/com/dayu/learncenter/ui/activity/VideoPlayActivity.java
0 → 100644
View file @
f88e6950
package
com
.
dayu
.
learncenter
.
ui
.
activity
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.view.View
;
import
android.widget.ImageView
;
import
com.dayu.base.ui.activity.BaseActivity
;
import
com.dayu.base.ui.presenter.SImplePresenter
;
import
com.dayu.learncenter.R
;
import
com.dayu.learncenter.api.bean.LiveBackVideosBean
;
import
com.dayu.learncenter.databinding.ActivityVideoPlayBinding
;
import
com.dayu.utils.GlideImageLoader
;
import
cn.jzvd.JzvdStd
;
public
class
VideoPlayActivity
extends
BaseActivity
<
SImplePresenter
,
ActivityVideoPlayBinding
>
{
LiveBackVideosBean
videoData
;
@Override
public
void
setPresenter
()
{
}
public
static
void
launch
(
Context
context
,
LiveBackVideosBean
videosBean
)
{
Intent
intent
=
new
Intent
(
context
,
VideoPlayActivity
.
class
);
intent
.
putExtra
(
"data"
,
videosBean
);
context
.
startActivity
(
intent
);
}
@Override
public
int
getLayoutId
()
{
return
R
.
layout
.
activity_video_play
;
}
@Override
public
void
initView
()
{
if
(
getIntent
().
hasExtra
(
"data"
))
videoData
=
(
LiveBackVideosBean
)
getIntent
().
getSerializableExtra
(
"data"
);
mBind
.
jzVideo
.
fullscreenButton
.
setVisibility
(
View
.
GONE
);
mBind
.
ivBack
.
setOnClickListener
(
v
->
dumpBack
());
if
(
videoData
!=
null
)
{
String
videoUrl
=
videoData
.
getVideoUrl
();
mBind
.
jzVideo
.
setUp
(
videoUrl
,
""
);
mBind
.
jzVideo
.
thumbImageView
.
setScaleType
(
ImageView
.
ScaleType
.
FIT_CENTER
);
GlideImageLoader
.
loadNoDeal
(
this
,
mBind
.
jzVideo
.
thumbImageView
,
videoData
.
getLiveStreamPic
(),
R
.
drawable
.
icon_video_default
);
mBind
.
jzVideo
.
startVideo
();
}
}
@Override
public
void
onPause
()
{
super
.
onPause
();
JzvdStd
.
goOnPlayOnPause
();
}
}
This diff is collapsed.
Click to expand it.
learnCenter/src/main/java/com/dayu/learncenter/ui/fragment/CommonLearnFragment.java
View file @
f88e6950
...
...
@@ -165,6 +165,7 @@ public class CommonLearnFragment extends BaseFragment<CommonLearnPresenter, Frag
@Override
public
void
shareVideo
(
CommonLearnBean
item
)
{
CommonUtils
.
shareWxVideo
(
mActivity
,
item
.
getUrl
(),
""
,
item
.
getName
(),
item
.
getBrief
(),
null
);
String
url
=
Constants
.
VIDEO_SHARE_URL
.
replace
(
"_type"
,
"course"
)+
item
.
getId
();
CommonUtils
.
shareWxUrl
(
mActivity
,
url
,
""
,
item
.
getName
(),
item
.
getBrief
(),
null
);
}
}
This diff is collapsed.
Click to expand it.
learnCenter/src/main/java/com/dayu/learncenter/ui/fragment/HomeLearnFragment.java
View file @
f88e6950
...
...
@@ -4,6 +4,7 @@ import android.content.res.AssetManager;
import
android.graphics.Typeface
;
import
android.support.design.widget.TabLayout
;
import
android.support.v4.app.Fragment
;
import
android.text.TextUtils
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.widget.TextView
;
...
...
@@ -18,9 +19,9 @@ import com.dayu.learncenter.api.bean.LearnTabBean;
import
com.dayu.learncenter.api.data.LiveData
;
import
com.dayu.learncenter.databinding.FragmentHomeLearnBinding
;
import
com.dayu.learncenter.event.RefreshLeanTabEvent
;
import
com.dayu.learncenter.ui.activity.P
repareLiv
eActivity
;
import
com.dayu.livemodule.StartPushEvent
;
import
com.dayu.livemodule.
xiaozhibo.anchor.prepare.TCAnchorPrepareActivity
;
import
com.dayu.learncenter.ui.activity.P
ubCours
eActivity
;
import
com.dayu.livemodule.
event.
StartPushEvent
;
import
com.dayu.livemodule.
event.UserKickOutEvent
;
import
com.dayu.utils.TabLayoutUtils
;
import
com.dayu.utils.UIUtils
;
import
com.umeng.analytics.MobclickAgent
;
...
...
@@ -28,6 +29,7 @@ import com.youth.banner.WeakHandler;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.Subscribe
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -57,8 +59,9 @@ public class HomeLearnFragment extends BaseFragment<SImplePresenter, FragmentHom
public
void
initView
()
{
initUser
();
tabDesc
=
UIUtils
.
getStrings
(
R
.
array
.
learn_top_tab_item
);
mBind
.
ivPubCourse
.
setOnClickListener
(
view
->
startActivity
(
TCAnchorPrepareActivity
.
class
));
mBind
.
ivPubCourse
.
setOnClickListener
(
view
->
startActivity
(
PrepareLiveActivity
.
class
));
// mBind.ivPubCourse.setOnClickListener(view -> startActivity(TCAnchorPrepareActivity.class));
mBind
.
ivPubCourse
.
setOnClickListener
(
view
->
startActivity
(
PubCourseActivity
.
class
));
// mBind.ivPubCourse.setOnClickListener(view -> startActivity(PrepareLiveActivity.class));
initTabPage
();
getTabData
();
EventBus
.
getDefault
().
register
(
this
);
...
...
@@ -77,10 +80,10 @@ public class HomeLearnFragment extends BaseFragment<SImplePresenter, FragmentHom
private
void
initTabPage
()
{
list_fragments
=
new
ArrayList
<>();
list_fragments
.
add
(
CommonLearnFragment
.
newInstance
(
1
));
list_fragments
.
add
(
new
LiveListFragment
());
list_fragments
.
add
(
CommonLearnFragment
.
newInstance
(
2
));
list_fragments
.
add
(
CommonLearnFragment
.
newInstance
(
3
));
// list_fragments.add(new TCVideoListFragment());
list_fragments
.
add
(
new
LiveListFragment
());
adapter
=
new
FragmentAdapter
(
getFragmentManager
(),
list_fragments
);
mBind
.
vpLearn
.
setAdapter
(
adapter
);
mBind
.
tabLearn
.
setupWithViewPager
(
mBind
.
vpLearn
);
...
...
@@ -98,8 +101,13 @@ public class HomeLearnFragment extends BaseFragment<SImplePresenter, FragmentHom
}
mTabNumTv
=
tab
.
getCustomView
().
findViewById
(
R
.
id
.
tabtext
);
mTabTextTv
=
tab
.
getCustomView
().
findViewById
(
R
.
id
.
tabicon
);
mTabNumTv
.
setTextColor
(
getResources
().
getColor
(
R
.
color
.
bg_button
));
mTabTextTv
.
setTextColor
(
getResources
().
getColor
(
R
.
color
.
bg_button
));
if
(
temp
==
1
){
mTabNumTv
.
setTextColor
(
getResources
().
getColor
(
R
.
color
.
common_red
));
mTabTextTv
.
setTextColor
(
getResources
().
getColor
(
R
.
color
.
common_red
));
}
else
{
mTabNumTv
.
setTextColor
(
getResources
().
getColor
(
R
.
color
.
bg_button
));
mTabTextTv
.
setTextColor
(
getResources
().
getColor
(
R
.
color
.
bg_button
));
}
mBind
.
vpLearn
.
setCurrentItem
(
temp
);
MobclickAgent
.
onPageStart
(
"HomeLearnFragment"
+
temp
);
}
...
...
@@ -127,16 +135,16 @@ public class HomeLearnFragment extends BaseFragment<SImplePresenter, FragmentHom
// EventBus.getDefault().post(new LearnTabNumEvent(1));
int
[]
tabNum
;
if
(
tabBean
!=
null
)
{
tabNum
=
new
int
[]{
tabBean
.
getTotalCourses
(),
tabBean
.
getLeaners
(),
tabBean
.
getPublishes
()};
tabNum
=
new
int
[]{
tabBean
.
getTotalCourses
(),
tabBean
.
getLives
(),
tabBean
.
getLeaners
(),
tabBean
.
getPublishes
()};
}
else
{
tabNum
=
new
int
[]{
0
,
0
,
0
};
tabNum
=
new
int
[]{
0
,
0
,
0
,
0
};
}
if
(
isFirstAddTab
)
{
mBind
.
tabLearn
.
removeAllTabs
();
mBind
.
tabLearn
.
addTab
(
mBind
.
tabLearn
.
newTab
().
setCustomView
(
CreatTab
(
0
,
tabNum
[
0
],
tabDesc
[
0
])));
mBind
.
tabLearn
.
addTab
(
mBind
.
tabLearn
.
newTab
().
setCustomView
(
CreatTab
(
1
,
tabNum
[
1
],
tabDesc
[
1
])));
mBind
.
tabLearn
.
addTab
(
mBind
.
tabLearn
.
newTab
().
setCustomView
(
CreatTab
(
2
,
tabNum
[
2
],
tabDesc
[
2
])));
mBind
.
tabLearn
.
addTab
(
mBind
.
tabLearn
.
newTab
().
setCustomView
(
CreatTab
(
3
,
0
,
tabDesc
[
3
])));
mBind
.
tabLearn
.
addTab
(
mBind
.
tabLearn
.
newTab
().
setCustomView
(
CreatTab
(
3
,
tabNum
[
3
]
,
tabDesc
[
3
])));
isFirstAddTab
=
false
;
}
else
{
for
(
int
i
=
0
;
i
<
mBind
.
tabLearn
.
getTabCount
();
i
++)
{
...
...
@@ -175,6 +183,14 @@ public class HomeLearnFragment extends BaseFragment<SImplePresenter, FragmentHom
}
@Subscribe
public
void
kickOutUser
(
UserKickOutEvent
event
)
{
showLoginDialog
();
// UserManager.getInstance().clearUserInfo();
// AppManager.getInstance().finishAllActivity();
// ARouter.getInstance().build(BaseConstant.PATH_LOGIN).navigation();
}
@Subscribe
public
void
startPush
(
StartPushEvent
event
)
{
sendLiveData
(
event
);
weakHandler
.
postDelayed
(()
->
{
...
...
@@ -186,6 +202,16 @@ public class HomeLearnFragment extends BaseFragment<SImplePresenter, FragmentHom
private
void
sendLiveData
(
StartPushEvent
event
)
{
int
type
=
event
.
isMain
?
1
:
2
;
LiveData
liveData
=
new
LiveData
(
type
,
event
.
pushUrl
);
if
(!
TextUtils
.
isEmpty
(
event
.
roomInfo
)){
try
{
JSONObject
jsonRoomInfo
=
new
JSONObject
(
event
.
roomInfo
);
liveData
.
title
=
jsonRoomInfo
.
optString
(
"title"
);
liveData
.
liveStreamPic
=
jsonRoomInfo
.
optString
(
"frontcover"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
Api
.
getService
(
LearnService
.
class
).
sendLiveData
(
liveData
).
compose
(
Api
.
applySchedulers
())
.
subscribe
(
mPresenter
.
baseObserver
(
result
->{}));
}
...
...
This diff is collapsed.
Click to expand it.
learnCenter/src/main/java/com/dayu/learncenter/ui/fragment/LiveListFragment.java
View file @
f88e6950
...
...
@@ -13,27 +13,29 @@ import com.dayu.base.ui.presenter.SImplePresenter;
import
com.dayu.common.Constants
;
import
com.dayu.learncenter.R
;
import
com.dayu.learncenter.api.LearnService
;
import
com.dayu.learncenter.api.bean.LiveVideosBean
;
import
com.dayu.learncenter.api.bean.Live
Back
VideosBean
;
import
com.dayu.learncenter.databinding.FragmentLiveListBinding
;
import
com.dayu.learncenter.event.RefreshLeanTabEvent
;
import
com.dayu.learncenter.ui.activity.VideoPlayActivity
;
import
com.dayu.livemodule.event.LiveFinishEvent
;
import
com.dayu.livemodule.xiaozhibo.audience.TCAudienceActivity
;
import
com.dayu.livemodule.xiaozhibo.common.utils.TCConstants
;
import
com.dayu.livemodule.xiaozhibo.main.videolist.utils.TCVideoInfo
;
import
com.dayu.livemodule.xiaozhibo.main.videolist.utils.TCVideoListMgr
;
import
com.dayu.utils.CommonUtils
;
import
com.dayu.utils.GlideImageLoader
;
import
com.dayu.widgets.JZMediaIjk
;
import
com.dayu.widgets.MyJzvdStd
;
import
org.greenrobot.eventbus.EventBus
;
import
org.greenrobot.eventbus.Subscribe
;
import
java.util.ArrayList
;
import
java.util.List
;
import
cn.jzvd.JzvdStd
;
public
class
LiveListFragment
extends
BaseFragment
<
SImplePresenter
,
FragmentLiveListBinding
>
{
List
<
TCVideoInfo
>
liveList
=
new
ArrayList
<>();
List
<
LiveVideosBean
>
playBackList
=
new
ArrayList
<>();
BaseQuickAdapter
<
LiveVideosBean
,
BaseViewHolder
>
playBackAdapter
;
List
<
Live
Back
VideosBean
>
playBackList
=
new
ArrayList
<>();
BaseQuickAdapter
<
Live
Back
VideosBean
,
BaseViewHolder
>
playBackAdapter
;
int
mPage
=
1
;
...
...
@@ -49,15 +51,23 @@ public class LiveListFragment extends BaseFragment<SImplePresenter, FragmentLive
@Override
public
void
initView
()
{
initUser
();
mBind
.
rvLive
.
setNestedScrollingEnabled
(
false
);
mBind
.
rvVideo
.
setNestedScrollingEnabled
(
false
);
mBind
.
rvVideo
.
setFocusable
(
false
);
mBind
.
rvVideo
.
setFocusableInTouchMode
(
false
);
mBind
.
rvLive
.
setFocusable
(
false
);
mBind
.
rvLive
.
setFocusableInTouchMode
(
false
);
mBind
.
refreshLayout
.
setOnRefreshListener
(
refreshLayout
->
{
mPage
=
1
;
mPage
=
1
;
initData
();
EventBus
.
getDefault
().
post
(
new
RefreshLeanTabEvent
());
});
mBind
.
refreshLayout
.
setOnLoadMoreListener
(
refreshLayout
->
{
getPlayBackVideos
();
});
EventBus
.
getDefault
().
register
(
this
);
}
@Override
...
...
@@ -66,6 +76,12 @@ public class LiveListFragment extends BaseFragment<SImplePresenter, FragmentLive
initData
();
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
EventBus
.
getDefault
().
unregister
(
this
);
}
private
void
initData
()
{
getLiveList
();
getPlayBackVideos
();
...
...
@@ -85,25 +101,6 @@ public class LiveListFragment extends BaseFragment<SImplePresenter, FragmentLive
});
}
//回放列表
private
void
getPlayBackVideos
()
{
Api
.
getService
(
LearnService
.
class
).
getLiveVideos
(
2
,
1
,
1
,
mPage
,
Constants
.
PAGESIZE
).
compose
(
Api
.
applySchedulers
())
.
subscribe
(
mPresenter
.
baseObserver
(
data
->{
mBind
.
refreshLayout
.
finishRefresh
();
mBind
.
refreshLayout
.
finishLoadMore
();
if
(
mPage
==
1
)
{
playBackList
.
clear
();
}
playBackList
.
addAll
(
data
.
getData
());
setPlaybackAdapter
();
mBind
.
refreshLayout
.
setEnableLoadMore
(
mPage
<
data
.
getTotalPages
());
mPage
+=
1
;
},
responeThrowable
->
{
mBind
.
refreshLayout
.
finishRefresh
();
mBind
.
refreshLayout
.
finishLoadMore
();
}));
}
private
void
setLiveAdapter
()
{
BaseQuickAdapter
<
TCVideoInfo
,
BaseViewHolder
>
liveAdapter
=
new
BaseQuickAdapter
<
TCVideoInfo
,
BaseViewHolder
>(
R
.
layout
.
item_video_live
,
liveList
)
{
...
...
@@ -139,20 +136,59 @@ public class LiveListFragment extends BaseFragment<SImplePresenter, FragmentLive
intent
.
putExtra
(
TCConstants
.
COVER_PIC
,
item
.
frontCover
);
intent
.
putExtra
(
TCConstants
.
TIMESTAMP
,
item
.
createTime
);
intent
.
putExtra
(
TCConstants
.
ROOM_TITLE
,
item
.
title
);
intent
.
putExtra
(
TCConstants
.
ROOM_INFO
,
item
.
roomInfo
);
mActivity
.
startActivity
(
intent
);
}
//回放列表
private
void
getPlayBackVideos
()
{
Api
.
getService
(
LearnService
.
class
).
getLiveVideos
(
mUserId
,
2
,
1
,
1
,
1
,
mPage
,
Constants
.
PAGESIZE
).
compose
(
Api
.
applySchedulers
())
.
subscribe
(
mPresenter
.
baseObserver
(
data
->
{
mBind
.
refreshLayout
.
finishRefresh
();
mBind
.
refreshLayout
.
finishLoadMore
();
if
(
mPage
==
1
)
{
playBackList
.
clear
();
}
playBackList
.
addAll
(
data
.
getData
());
setPlaybackAdapter
();
mBind
.
refreshLayout
.
setEnableLoadMore
(
mPage
<
data
.
getTotalPages
());
mPage
+=
1
;
},
responeThrowable
->
{
mBind
.
refreshLayout
.
finishRefresh
();
mBind
.
refreshLayout
.
finishLoadMore
();
}));
}
private
void
setPlaybackAdapter
()
{
if
(
playBackAdapter
!=
null
){
if
(
playBackAdapter
!=
null
)
{
playBackAdapter
.
notifyDataSetChanged
();
}
else
{
playBackAdapter
=
new
BaseQuickAdapter
<
LiveVideosBean
,
BaseViewHolder
>(
R
.
layout
.
item_live_play_back
,
playBackList
)
{
}
else
{
playBackAdapter
=
new
BaseQuickAdapter
<
Live
Back
VideosBean
,
BaseViewHolder
>(
R
.
layout
.
item_live_play_back
,
playBackList
)
{
@Override
protected
void
convert
(
BaseViewHolder
helper
,
LiveVideosBean
item
)
{
protected
void
convert
(
BaseViewHolder
helper
,
LiveBackVideosBean
item
)
{
ImageView
ivLike
=
helper
.
getView
(
R
.
id
.
iv_like
);
ivLike
.
setImageResource
(
item
.
getPointStatus
()
==
1
?
R
.
drawable
.
icon_like_red
:
R
.
drawable
.
icon_like_gray
);
helper
.
setText
(
R
.
id
.
tv_title
,
item
.
getTitle
());
MyJzvdStd
jzVideo
=
helper
.
getView
(
R
.
id
.
jz_video
);
jzVideo
.
setUp
(
item
.
getVideoUrl
(),
""
,
JzvdStd
.
SCREEN_NORMAL
,
JZMediaIjk
.
class
);
CommonUtils
.
setVideoThumb
(
mContext
,
jzVideo
,
item
.
getVideoUrl
());
helper
.
setText
(
R
.
id
.
tv_looks
,
item
.
getPlayBackNum
()
+
""
);
helper
.
setText
(
R
.
id
.
tv_like
,
item
.
getPointNum
()
+
""
);
ivLike
.
setOnClickListener
(
v
->
pointBackVideo
(
item
));
helper
.
setOnClickListener
(
R
.
id
.
ib_share
,
v
->
shareBackVideo
(
item
));
ImageView
ivCover
=
helper
.
getView
(
R
.
id
.
iv_cover
);
GlideImageLoader
.
load
(
mActivity
,
ivCover
,
item
.
getLiveStreamPic
(),
R
.
drawable
.
icon_video_default
);
ivCover
.
setOnClickListener
(
v
->{
VideoPlayActivity
.
launch
(
mActivity
,
item
);
playBackVideo
(
item
.
getId
());
});
// MyJzvdStd jzVideo = helper.getView(R.id.jz_video);
// jzVideo.setUp(item.getVideoUrl(), "", JzvdStd.SCREEN_NORMAL, JZMediaIjk.class);
// CommonUtils.setVideoThumb(mContext, jzVideo, item.getVideoUrl());
// jzVideo.setStartCallBack(() ->{
// playBackVideo(item.getId());
//// showToast("play: "+jzVideo.curPosition);
// });
}
};
mBind
.
rvVideo
.
setLayoutManager
(
new
LinearLayoutManager
(
mActivity
));
...
...
@@ -160,4 +196,37 @@ public class LiveListFragment extends BaseFragment<SImplePresenter, FragmentLive
}
}
//回放视频点赞
private
void
pointBackVideo
(
LiveBackVideosBean
item
)
{
int
type
=
item
.
getPointStatus
()
==
1
?
2
:
1
;
showDialog
();
Api
.
getService
(
LearnService
.
class
).
pointBackVideo
(
item
.
getId
(),
mUserId
,
type
).
compose
(
Api
.
applySchedulers
())
.
subscribe
(
mPresenter
.
baseObserver
(
success
->
{
if
(
success
)
{
item
.
setPointStatus
(
type
);
item
.
setPointNum
(
type
==
1
?
item
.
getPointNum
()
+
1
:
item
.
getPointNum
()
-
1
);
setPlaybackAdapter
();
}
else
{
showToast
(
"操作失败"
);
}
}));
}
//观看回放视频
private
void
playBackVideo
(
int
id
)
{
Api
.
getService
(
LearnService
.
class
).
playBackVideo
(
id
).
compose
(
Api
.
applySchedulers
())
.
subscribe
(
mPresenter
.
baseObserver
(
success
->
{
}));
}
//分享回放视频
private
void
shareBackVideo
(
LiveBackVideosBean
item
)
{
String
url
=
Constants
.
VIDEO_SHARE_URL
.
replace
(
"_type"
,
"live"
)
+
item
.
getId
();
CommonUtils
.
shareWxUrl
(
mActivity
,
url
,
item
.
getLiveStreamPic
(),
item
.
getTitle
(),
" "
,
null
);
}
@Subscribe
public
void
liveEnd
(
LiveFinishEvent
event
){
initData
();
}
}
This diff is collapsed.
Click to expand it.
learnCenter/src/main/release/AndroidManifest.xml
View file @
f88e6950
...
...
@@ -19,6 +19,9 @@
<activity
android:name=
".ui.activity.PrepareLiveActivity"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
".ui.activity.VideoPlayActivity"
android:screenOrientation=
"portrait"
/>
</application>
</manifest>
...
...
This diff is collapsed.
Click to expand it.
learnCenter/src/main/res/layout/activity_course_detail.xml
View file @
f88e6950
...
...
@@ -143,6 +143,12 @@
android:layout_height=
"match_parent"
android:gravity=
"center"
android:text=
"0"
/>
<ImageButton
android:id=
"@+id/ib_share"
android:layout_width=
"40dp"
android:background=
"@color/transparent"
android:layout_height=
"match_parent"
android:src=
"@drawable/icon_share_gray"
/>
</LinearLayout>
...
...
This diff is collapsed.
Click to expand it.
learnCenter/src/main/res/layout/activity_prepare_live.xml
View file @
f88e6950
...
...
@@ -33,9 +33,11 @@
<ImageView
android:id=
"@+id/iv_cover"
android:layout_width=
"match_parent"
android:layout_height=
"2
5
0dp"
android:layout_height=
"2
0
0dp"
android:onClick=
"onClick"
android:scaleType=
"fitXY"
/>
android:background=
"@color/black"
android:scaleType=
"centerCrop"
/>
<TextView
android:id=
"@+id/tv_tips"
...
...
This diff is collapsed.
Click to expand it.
learnCenter/src/main/res/layout/activity_video_play.xml
0 → 100644
View file @
f88e6950
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/cl_bg"
>
<com.dayu.widgets.MyJzvdStd
android:id=
"@+id/jz_video"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
<ImageView
android:id=
"@+id/iv_back"
android:layout_width=
"35dp"
android:layout_height=
"35dp"
android:layout_alignParentStart=
"true"
android:layout_alignParentLeft=
"true"
android:layout_alignParentTop=
"true"
android:layout_marginLeft=
"5dp"
android:layout_marginTop=
"6dp"
android:scaleType=
"centerInside"
android:src=
"@drawable/jz_click_back_selector"
/>
</RelativeLayout>
</layout>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
learnCenter/src/main/res/layout/item_live_play_back.xml
View file @
f88e6950
...
...
@@ -17,10 +17,13 @@
android:layout_width=
"match_parent"
android:layout_height=
"180dp"
>
<com.dayu.widgets.MyJzvdStd
android:id=
"@+id/jz_video"
<ImageView
android:id=
"@+id/iv_cover"
android:scaleType=
"centerCrop"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
android:layout_height=
"match_parent"
android:background=
"@color/black"
/>
<RelativeLayout
android:id=
"@+id/rl_cover"
...
...
@@ -28,17 +31,12 @@
android:layout_height=
"match_parent"
android:background=
"@color/transparent"
>
<TextView
android:id=
"@+id/tv_progress"
style=
"@style/common_text_style"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"15dp"
android:padding=
"10dp"
android:text=
"@string/learn_progress"
android:textColor=
"@color/text_common_blue"
android:textSize=
"20sp"
android:visibility=
"gone"
/>
<ImageView
android:layout_width=
"45dp"
android:layout_height=
"45dp"
android:src=
"@drawable/jz_play_normal"
android:layout_centerInParent=
"true"
/>
<TextView
android:id=
"@+id/tv_disable"
...
...
This diff is collapsed.
Click to expand it.
learnCenter/src/main/res/layout/item_video_live.xml
View file @
f88e6950
...
...
@@ -19,7 +19,8 @@
<ImageView
android:id=
"@+id/iv_cover"
android:scaleType=
"fitXY"
android:scaleType=
"centerCrop"
android:background=
"@color/black"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
...
...
This diff is collapsed.
Click to expand it.
liveModule/src/main/java/com/dayu/livemodule/LiveUtils.java
View file @
f88e6950
package
com
.
dayu
.
livemodule
;
import
android.content.Context
;
import
android.os.Bundle
;
import
com.dayu.livemodule.roomutil.commondef.AnchorInfo
;
import
com.dayu.livemodule.roomutil.commondef.AudienceInfo
;
import
com.dayu.livemodule.roomutil.commondef.MLVBCommonDef
;
import
com.dayu.livemodule.xiaozhibo.TCGlobalConfig
;
import
com.dayu.livemodule.xiaozhibo.common.net.TCHTTPMgr
;
import
com.dayu.livemodule.xiaozhibo.common.utils.TCUtils
;
import
com.dayu.livemodule.xiaozhibo.login.TCUserMgr
;
import
com.tencent.rtmp.TXLiveBase
;
...
...
@@ -19,6 +24,8 @@ public class LiveUtils {
// 必须:初始化全局的 用户信息管理类,记录个人信息。
TCUserMgr
.
getInstance
().
initContext
(
context
);
initSingUserListener
(
context
);
}
...
...
@@ -53,4 +60,96 @@ public class LiveUtils {
}
public
static
void
initEnv
(
String
enviroment
)
{
TCGlobalConfig
.
ENVIRONMENT
=
enviroment
;
switch
(
enviroment
){
case
"debug"
:
TCGlobalConfig
.
pushURLPrefix
=
"rtmp://push.dev.kf.ai"
;
break
;
case
"uat"
:
TCGlobalConfig
.
pushURLPrefix
=
"rtmp://push.uat.kf.ai"
;
break
;
case
"release"
:
TCGlobalConfig
.
pushURLPrefix
=
"rtmp://push.kf.ai"
;
break
;
}
}
private
static
void
initSingUserListener
(
Context
context
){
MLVBLiveRoom
.
sharedInstance
(
context
).
setListener
(
new
IMLVBLiveRoomListener
()
{
@Override
public
void
onError
(
int
errCode
,
String
errMsg
,
Bundle
extraInfo
)
{
if
(
errCode
==
MLVBCommonDef
.
LiveRoomErrorCode
.
ERROR_IM_FORCE_OFFLINE
)
{
TCUtils
.
showKickOut
(
context
);
}
}
@Override
public
void
onWarning
(
int
warningCode
,
String
warningMsg
,
Bundle
extraInfo
)
{
}
@Override
public
void
onDebugLog
(
String
log
)
{
}
@Override
public
void
onRoomDestroy
(
String
roomID
)
{
}
@Override
public
void
onAnchorEnter
(
AnchorInfo
anchorInfo
)
{
}
@Override
public
void
onAnchorExit
(
AnchorInfo
anchorInfo
)
{
}
@Override
public
void
onAudienceEnter
(
AudienceInfo
audienceInfo
)
{
}
@Override
public
void
onAudienceExit
(
AudienceInfo
audienceInfo
)
{
}
@Override
public
void
onRequestJoinAnchor
(
AnchorInfo
anchorInfo
,
String
reason
)
{
}
@Override
public
void
onKickoutJoinAnchor
()
{
}
@Override
public
void
onRequestRoomPK
(
AnchorInfo
anchorInfo
)
{
}
@Override
public
void
onQuitRoomPK
(
AnchorInfo
anchorInfo
)
{
}
@Override
public
void
onRecvRoomTextMsg
(
String
roomID
,
String
userID
,
String
userName
,
String
userAvatar
,
String
message
)
{
}
@Override
public
void
onRecvRoomCustomMsg
(
String
roomID
,
String
userID
,
String
userName
,
String
userAvatar
,
String
cmd
,
String
message
)
{
}
});
}
}
This diff is collapsed.
Click to expand it.
liveModule/src/main/java/com/dayu/livemodule/MLVBLiveRoom.java
View file @
f88e6950
...
...
@@ -251,7 +251,7 @@ public abstract class MLVBLiveRoom {
* @param callback 进入连麦的结果回调
*
*/
public
abstract
void
joinAnchor
(
final
IMLVBLiveRoomListener
.
JoinAnchorCallback
callback
);
public
abstract
void
joinAnchor
(
String
roomInfo
,
final
IMLVBLiveRoomListener
.
JoinAnchorCallback
callback
);
/**
* 观众退出连麦
...
...
This diff is collapsed.
Click to expand it.
liveModule/src/main/java/com/dayu/livemodule/MLVBLiveRoomImpl.java
View file @
f88e6950
...
...
@@ -13,6 +13,7 @@ import android.text.TextUtils;
import
android.util.Log
;
import
android.view.View
;
import
com.dayu.livemodule.event.StartPushEvent
;
import
com.dayu.livemodule.roomutil.commondef.AnchorInfo
;
import
com.dayu.livemodule.roomutil.commondef.AudienceInfo
;
import
com.dayu.livemodule.roomutil.commondef.LoginInfo
;
...
...
@@ -21,6 +22,7 @@ import com.dayu.livemodule.roomutil.commondef.RoomInfo;
import
com.dayu.livemodule.roomutil.http.HttpRequests
;
import
com.dayu.livemodule.roomutil.http.HttpResponse
;
import
com.dayu.livemodule.roomutil.im.IMMessageMgr
;
import
com.dayu.livemodule.xiaozhibo.TCGlobalConfig
;
import
com.google.gson.Gson
;
import
com.google.gson.reflect.TypeToken
;
import
com.tencent.imsdk.TIMUserProfile
;
...
...
@@ -316,8 +318,8 @@ public class MLVBLiveRoomImpl extends MLVBLiveRoom implements HttpRequests.Heart
*/
@Override
public
void
getAudienceList
(
final
IMLVBLiveRoomListener
.
GetAudienceListCallback
callback
)
{
TXCLog
.
i
(
TAG
,
"API -> getAudienceList
"
);
if
(
mCurrRoomID
==
null
||
mCurrRoomID
.
length
()
>
0
)
{
TXCLog
.
i
(
TAG
,
"API -> getAudienceList
"
+
mCurrRoomID
);
if
(
mCurrRoomID
==
null
||
mCurrRoomID
.
length
()
==
0
)
{
callbackOnThread
(
callback
,
"onError"
,
MLVBCommonDef
.
LiveRoomErrorCode
.
ERROR_NOT_IN_ROOM
,
"[LiveRoom] getAudienceList 失败[房间号为空]"
);
return
;
}
...
...
@@ -338,17 +340,14 @@ public class MLVBLiveRoomImpl extends MLVBLiveRoom implements HttpRequests.Heart
@Override
public
void
onSuccess
(
List
<
TIMUserProfile
>
timUserProfiles
)
{
final
ArrayList
<
AudienceInfo
>
audienceList
=
new
ArrayList
<>();
for
(
TIMUserProfile
userProfile
:
timUserProfiles
)
{
AudienceInfo
audienceInfo
=
new
AudienceInfo
();
audienceInfo
.
userID
=
userProfile
.
getIdentifier
();
audienceInfo
.
userName
=
userProfile
.
getNickName
();
audienceInfo
.
userAvatar
=
userProfile
.
getFaceUrl
();
mAudiences
.
put
(
userProfile
.
getIdentifier
(),
audienceInfo
);
}
final
ArrayList
<
AudienceInfo
>
audienceList
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
AudienceInfo
>
item
:
mAudiences
.
entrySet
())
{
audienceList
.
add
(
item
.
getValue
());
audienceList
.
add
(
audienceInfo
);
}
callbackOnThread
(
callback
,
"onSuccess"
,
audienceList
);
}
...
...
@@ -381,13 +380,13 @@ public class MLVBLiveRoomImpl extends MLVBLiveRoom implements HttpRequests.Heart
@Override
public
void
onResponse
(
int
retcode
,
String
retmsg
,
HttpResponse
.
PushUrl
data
)
{
if
(
retcode
==
HttpResponse
.
CODE_OK
&&
data
!=
null
&&
data
.
pushURL
!=
null
)
{
final
String
pushURL
=
data
.
pushURL
;
// final String pushURL = ""
;
mSelfPushUrl
=
data
.
pushURL
;
//
final String pushURL = data.pushURL;
final
String
pushURL
=
TCGlobalConfig
.
pushURLPrefix
+
data
.
pushURL
.
substring
(
data
.
pushURL
.
indexOf
(
"/live"
),
data
.
pushURL
.
length
())
;
mSelfPushUrl
=
pushURL
;
mSelfAccelerateURL
=
data
.
accelerateURL
;
TXCLog
.
i
(
TAG
,
"API -> createRoom push url:"
+
pushURL
);
TXCLog
.
i
(
TAG
,
"API -> createRoom push url2:"
+
mSelfAccelerate
URL
);
TXCLog
.
i
(
TAG
,
"API -> createRoom push url2:"
+
data
.
push
URL
);
//3.开始推流
startPushStream
(
pushURL
,
TXLiveConstants
.
VIDEO_QUALITY_HIGH_DEFINITION
,
new
StandardCallback
()
{
...
...
@@ -409,7 +408,7 @@ public class MLVBLiveRoomImpl extends MLVBLiveRoom implements HttpRequests.Heart
mTXLivePusher
.
setConfig
(
config
);
}
EventBus
.
getDefault
().
post
(
new
StartPushEvent
(
true
,
mSelfPushUrl
));
EventBus
.
getDefault
().
post
(
new
StartPushEvent
(
true
,
mSelfPushUrl
,
roomInfo
));
mBackground
=
false
;
//4.推流成功,请求CGI:create_room,获取roomID、roomSig
String
mRoomInfo
=
roomInfo
;
...
...
@@ -522,6 +521,7 @@ public class MLVBLiveRoomImpl extends MLVBLiveRoom implements HttpRequests.Heart
int
playType
=
getPlayType
(
mixedPlayUrl
);
mTXLivePlayer
.
setPlayerView
(
view
);
mTXLivePlayer
.
startPlay
(
mixedPlayUrl
,
playType
);
TXCLog
.
i
(
TAG
,
"startPlay "
+
mixedPlayUrl
+
" "
+
playType
);
if
(
mHttpRequest
!=
null
)
{
String
userInfo
=
""
;
...
...
@@ -533,7 +533,12 @@ public class MLVBLiveRoomImpl extends MLVBLiveRoom implements HttpRequests.Heart
}
catch
(
JSONException
e
)
{
userInfo
=
""
;
}
mHttpRequest
.
addAudience
(
roomID
,
mSelfAccountInfo
.
userID
,
userInfo
,
null
);
mHttpRequest
.
addAudience
(
roomID
,
mSelfAccountInfo
.
userID
,
userInfo
,
new
HttpRequests
.
OnResponseCallback
<
HttpResponse
>()
{
@Override
public
void
onResponse
(
int
retcode
,
@Nullable
String
retmsg
,
@Nullable
HttpResponse
data
)
{
TXCLog
.
i
(
TAG
,
"addAudience "
+
roomID
+
" "
+
retcode
+
" "
+
retmsg
);
}
});
}
callbackOnThread
(
callback
,
"onSuccess"
);
}
else
{
...
...
@@ -873,7 +878,7 @@ public class MLVBLiveRoomImpl extends MLVBLiveRoom implements HttpRequests.Heart
* @param callback 进入连麦的结果回调
*/
@Override
public
void
joinAnchor
(
final
IMLVBLiveRoomListener
.
JoinAnchorCallback
callback
)
{
public
void
joinAnchor
(
String
roomInfo
,
final
IMLVBLiveRoomListener
.
JoinAnchorCallback
callback
)
{
TXCLog
.
i
(
TAG
,
"API -> joinAnchor"
);
if
(
mCurrRoomID
==
null
||
mCurrRoomID
.
length
()
==
0
)
{
callbackOnThread
(
callback
,
"onError"
,
MLVBCommonDef
.
LiveRoomErrorCode
.
ERROR_NOT_IN_ROOM
,
"[LiveRoom] 观众进入连麦失败[房间号为空,请确认是否已经进房]"
);
...
...
@@ -904,11 +909,18 @@ public class MLVBLiveRoomImpl extends MLVBLiveRoom implements HttpRequests.Heart
@Override
public
void
onResponse
(
int
retcode
,
String
retmsg
,
final
HttpResponse
.
PushUrl
data
)
{
if
(
retcode
==
HttpResponse
.
CODE_OK
&&
data
!=
null
&&
data
.
pushURL
!=
null
)
{
mSelfPushUrl
=
data
.
pushURL
;
// mSelfPushUrl = data.pushURL;
// mSelfAccelerateURL = data.accelerateURL;
final
String
pushURL
=
TCGlobalConfig
.
pushURLPrefix
+
data
.
pushURL
.
substring
(
data
.
pushURL
.
indexOf
(
"/live"
),
data
.
pushURL
.
length
());
mSelfPushUrl
=
pushURL
;
mSelfAccelerateURL
=
data
.
accelerateURL
;
TXCLog
.
i
(
TAG
,
"API -> createRoom push join url:"
+
pushURL
);
TXCLog
.
i
(
TAG
,
"API -> createRoom push join url2:"
+
data
.
pushURL
+
" "
+
roomInfo
);
//5. 开始推流
startPushStream
(
data
.
pushURL
,
TXLiveConstants
.
VIDEO_QUALITY_LINKMIC_SUB_PUBLISHER
,
new
StandardCallback
()
{
startPushStream
(
pushURL
,
TXLiveConstants
.
VIDEO_QUALITY_LINKMIC_SUB_PUBLISHER
,
new
StandardCallback
()
{
@Override
public
void
onError
(
final
int
code
,
final
String
info
)
{
callbackOnThread
(
callback
,
"onError"
,
code
,
info
);
...
...
@@ -917,7 +929,7 @@ public class MLVBLiveRoomImpl extends MLVBLiveRoom implements HttpRequests.Heart
@Override
public
void
onSuccess
()
{
mBackground
=
false
;
EventBus
.
getDefault
().
post
(
new
StartPushEvent
(
false
,
mSelfPushUrl
));
EventBus
.
getDefault
().
post
(
new
StartPushEvent
(
false
,
mSelfPushUrl
,
roomInfo
));
//6. 推流成功,请求CGI:add_pusher,把自己加入房间成员列表
addAnchor
(
mCurrRoomID
,
data
.
pushURL
,
new
StandardCallback
()
{
@Override
...
...
@@ -2319,6 +2331,7 @@ public class MLVBLiveRoomImpl extends MLVBLiveRoom implements HttpRequests.Heart
TXLivePushConfig
config
=
new
TXLivePushConfig
();
config
.
setFrontCamera
(
frontCamera
);
config
.
enableScreenCaptureAutoRotate
(
mScreenAutoEnable
);
// 是否开启屏幕自适应
// config.setHomeOrientation(TXLiveConstants.VIDEO_ANGLE_HOME_RIGHT); //横屏推流
config
.
setPauseFlag
(
TXLiveConstants
.
PAUSE_FLAG_PAUSE_VIDEO
|
TXLiveConstants
.
PAUSE_FLAG_PAUSE_AUDIO
);
mTXLivePusher
.
setConfig
(
config
);
mTXLivePusher
.
setBeautyFilter
(
TXLiveConstants
.
BEAUTY_STYLE_SMOOTH
,
5
,
3
,
2
);
...
...
This diff is collapsed.
Click to expand it.
liveModule/src/main/java/com/dayu/livemodule/event/LiveFinishEvent.java
0 → 100644
View file @
f88e6950
package
com
.
dayu
.
livemodule
.
event
;
//直播结束
public
class
LiveFinishEvent
{
}
This diff is collapsed.
Click to expand it.
liveModule/src/main/java/com/dayu/livemodule/StartPushEvent.java
→
liveModule/src/main/java/com/dayu/livemodule/
event/
StartPushEvent.java
View file @
f88e6950
package
com
.
dayu
.
livemodule
;
package
com
.
dayu
.
livemodule
.
event
;
public
class
StartPushEvent
{
public
boolean
isMain
;
public
String
pushUrl
;
public
String
roomInfo
;
public
StartPushEvent
(
boolean
isMain
,
String
pushUrl
)
{
public
StartPushEvent
(
boolean
isMain
,
String
pushUrl
,
String
roomInfo
)
{
this
.
isMain
=
isMain
;
this
.
pushUrl
=
pushUrl
;
this
.
roomInfo
=
roomInfo
;
}
}
This diff is collapsed.
Click to expand it.
liveModule/src/main/java/com/dayu/livemodule/event/UserKickOutEvent.java
0 → 100644
View file @
f88e6950
package
com
.
dayu
.
livemodule
.
event
;
//用户被顶替下线
public
class
UserKickOutEvent
{
}
This diff is collapsed.
Click to expand it.
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/TCGlobalConfig.java
View file @
f88e6950
...
...
@@ -2,9 +2,9 @@ package com.dayu.livemodule.xiaozhibo;
/**
* Module: TCGlobalConfig
*
*
<p>
* Function: 小直播 的全局配置类
*
*
<p>
* 1. LiteAVSDK Licence
* 2. 计算腾讯云 UserSig 的 SDKAppId、加密密钥、签名过期时间
* 3. 小直播后台服务器地址
...
...
@@ -15,9 +15,25 @@ package com.dayu.livemodule.xiaozhibo;
public
class
TCGlobalConfig
{
/**
* 1. LiteAVSDK Licence。 用于直播推流鉴权。
*
* 获取License,请参考官网指引 https://cloud.tencent.com/document/product/454/34750
* 自定义推流域名
*/
// public static String pushURLPrefix = "rtmp://push.dev.kf.ai"; //dev
// public static String ENVIRONMENT = "debug"; //dev
public
static
String
pushURLPrefix
=
"rtmp://push.uat.kf.ai"
;
//uat
public
static
String
ENVIRONMENT
=
"uat"
;
//dev
// public static String pushURLPrefix = "rtmp://push.kf.ai"; //release
// public static String ENVIRONMENT = "release"; //release
public
static
final
String
LIVE_ENVIRONMENT
=
"environment"
;
/**
* 1. LiteAVSDK Licence。 用于直播推流鉴权。
* <p>
* 获取License,请参考官网指引 https://cloud.tencent.com/document/product/454/34750
*/
public
static
final
String
LICENCE_URL
=
"http://license.vod2.myqcloud.com/license/v1/39b40793d12654ed50ea2609252b38ea/TXLiveSDK.licence"
;
public
static
final
String
LICENCE_KEY
=
"b89b0a2d023fd96d04b6888c39eb3e6b"
;
...
...
@@ -25,7 +41,7 @@ public class TCGlobalConfig {
/**
* 2.1 腾讯云 SDKAppId,需要替换为您自己账号下的 SDKAppId。
*
*
<p>
* 进入腾讯云直播[控制台-直播SDK-应用管理](https://console.cloud.tencent.com/live/license/appmanage) 创建应用,即可看到 SDKAppId,
* 它是腾讯云用于区分客户的唯一标识。
*/
...
...
@@ -33,12 +49,12 @@ public class TCGlobalConfig {
/**
* 2.2 计算签名用的加密密钥,获取步骤如下:
*
*
<p>
* step1. 进入腾讯云直播[控制台-直播SDK-应用管理](https://console.cloud.tencent.com/live/license/appmanage),如果还没有应用就创建一个,
* step2. 单击您的应用,进入"应用管理"页面。
* step3. 点击“查看密钥”按钮,就可以看到计算 UserSig 使用的加密的密钥了,请将其拷贝并复制到如下的变量中。
*
如果提示"请先添加管理员才能生成公私钥",点击"编辑",输入管理员名称,如"admin",点"确定"添加管理员。然后再查看密钥。
*
* 如果提示"请先添加管理员才能生成公私钥",点击"编辑",输入管理员名称,如"admin",点"确定"添加管理员。然后再查看密钥。
*
<p>
* 注意:该方案仅适用于调试Demo,正式上线前请将 UserSig 计算代码和密钥迁移到您的后台服务器上,以避免加密密钥泄露导致的流量盗用。
* 文档:https://cloud.tencent.com/document/product/647/17275#Server
*/
...
...
@@ -55,37 +71,37 @@ public class TCGlobalConfig {
/**
* 3. 小直播后台服务器地址
*
*
<p>
* 3.1 您可以不填写后台服务器地址:
*
小直播 App 单靠客户端源码运行,方便快速跑通体验小直播。
*
不过在这种模式下运行的“小直播”,没有注册登录、回放列表等功能,仅有基本的直播推拉流、聊天室、连麦等功能。
*
另外在这种模式下,腾讯云安全签名 UserSig 是使用本地 GenerateTestUserSig 模块计算的,存在 SECRETKEY 被破解的导致腾讯云流量被盗用的风险。
*
* 小直播 App 单靠客户端源码运行,方便快速跑通体验小直播。
* 不过在这种模式下运行的“小直播”,没有注册登录、回放列表等功能,仅有基本的直播推拉流、聊天室、连麦等功能。
* 另外在这种模式下,腾讯云安全签名 UserSig 是使用本地 GenerateTestUserSig 模块计算的,存在 SECRETKEY 被破解的导致腾讯云流量被盗用的风险。
*
<p>
* 3.2 您可以填写后台服务器地址:
*
服务器需要您参考文档 https://cloud.tencent.com/document/product/454/15187 自行搭建。
*
服务器提供注册登录、回放列表、计算 UserSig 等服务。
*
这种情况下 {@link #SDKAPPID} 和 {@link #SECRETKEY} 可以设置为任意值。
*
*
服务器需要您参考文档 https://cloud.tencent.com/document/product/454/15187 自行搭建。
* 服务器提供注册登录、回放列表、计算 UserSig 等服务。
*
这种情况下 {@link #SDKAPPID} 和 {@link #SECRETKEY} 可以设置为任意值。
*
<p>
* 注意:
*
后台服务器地址(APP_SVR_URL)和 (SDKAPPID,SECRETKEY)一定要填一项。
*
要么填写后台服务器地址(@link #APP_SVR_URL),要么填写 {@link #SDKAPPID} 和 {@link #SECRETKEY}。
*
* 后台服务器地址(APP_SVR_URL)和 (SDKAPPID,SECRETKEY)一定要填一项。
* 要么填写后台服务器地址(@link #APP_SVR_URL),要么填写 {@link #SDKAPPID} 和 {@link #SECRETKEY}。
*
<p>
* 详情请参考:
*/
public
static
final
String
APP_SVR_URL
=
""
;
/**
*
4. App 主色调。
* 4. App 主色调。
*/
public
static
final
int
MAIN_COLOR
=
0xff222B48
;
/**
*
5. 是否启用连麦。
*
*
由于连麦功能使用了比较昂贵的 BGP 专用线路,所以是按照通话时长进行收费的。最初级的体验包包含 3000 分钟的连麦时长,只需要 9.8 元。
*
购买链接:https://buy.cloud.tencent.com/mobilelive?urlctr=yes&micconn=3000m##
* 5. 是否启用连麦。
*
<p>
* 由于连麦功能使用了比较昂贵的 BGP 专用线路,所以是按照通话时长进行收费的。最初级的体验包包含 3000 分钟的连麦时长,只需要 9.8 元。
* 购买链接:https://buy.cloud.tencent.com/mobilelive?urlctr=yes&micconn=3000m##
*/
public
static
final
boolean
ENABLE_LINKMIC
=
true
;
...
...
This diff is collapsed.
Click to expand it.
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/anchor/TCBaseAnchorActivity.java
View file @
f88e6950
...
...
@@ -47,7 +47,6 @@ import org.json.JSONObject;
import
java.io.UnsupportedEncodingException
;
import
java.util.ArrayList
;
import
java.util.Locale
;
import
java.util.Timer
;
import
java.util.TimerTask
;
...
...
@@ -233,6 +232,7 @@ public class TCBaseAnchorActivity extends Activity implements IMLVBLiveRoomListe
.
put
(
"title"
,
mTitle
)
.
put
(
"frontcover"
,
mCoverPicUrl
)
.
put
(
"location"
,
mLocation
)
.
put
(
TCGlobalConfig
.
LIVE_ENVIRONMENT
,
TCGlobalConfig
.
ENVIRONMENT
)
.
toString
();
}
catch
(
JSONException
e
)
{
roomInfo
=
mTitle
;
...
...
@@ -374,6 +374,7 @@ public class TCBaseAnchorActivity extends Activity implements IMLVBLiveRoomListe
@Override
public
void
onError
(
int
errorCode
,
String
errorMessage
,
Bundle
extraInfo
)
{
if
(
errorCode
==
MLVBCommonDef
.
LiveRoomErrorCode
.
ERROR_IM_FORCE_OFFLINE
)
{
finish
();
TCUtils
.
showKickOut
(
TCBaseAnchorActivity
.
this
);
}
else
{
showErrorAndQuit
(
errorCode
,
errorMessage
);
...
...
@@ -590,18 +591,20 @@ public class TCBaseAnchorActivity extends Activity implements IMLVBLiveRoomListe
* 如:观看数量、点赞数量、直播时长数
*/
protected
void
showPublishFinishDetailsDialog
()
{
//确认则显示观看detail
FinishDetailDialogFragment
dialogFragment
=
new
FinishDetailDialogFragment
();
Bundle
args
=
new
Bundle
();
args
.
putString
(
"time"
,
TCUtils
.
formattedTime
(
mSecond
));
args
.
putString
(
"heartCount"
,
String
.
format
(
Locale
.
CHINA
,
"%d"
,
mHeartCount
));
args
.
putString
(
"totalMemberCount"
,
String
.
format
(
Locale
.
CHINA
,
"%d"
,
mTotalMemberCount
));
dialogFragment
.
setArguments
(
args
);
dialogFragment
.
setCancelable
(
false
);
if
(
dialogFragment
.
isAdded
())
dialogFragment
.
dismiss
();
else
dialogFragment
.
show
(
getFragmentManager
(),
""
);
finish
();
// //确认则显示观看detail
// FinishDetailDialogFragment dialogFragment = new FinishDetailDialogFragment();
// Bundle args = new Bundle();
// args.putString("time", TCUtils.formattedTime(mSecond));
// args.putString("heartCount", String.format(Locale.CHINA, "%d", mHeartCount));
// args.putString("totalMemberCount", String.format(Locale.CHINA, "%d", mTotalMemberCount));
// dialogFragment.setArguments(args);
// dialogFragment.setCancelable(false);
// if (dialogFragment.isAdded())
// dialogFragment.dismiss();
// else
// dialogFragment.show(getFragmentManager(), "");
}
/**
...
...
This diff is collapsed.
Click to expand it.
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/anchor/music/TCAudioControl.java
View file @
f88e6950
...
...
@@ -233,19 +233,21 @@ public class TCAudioControl extends LinearLayout implements SeekBar.OnSeekBarCha
}
if
(
R
.
id
.
btn_stop_bgm
!=
v
.
getId
()
&&
v
.
getId
()
!=
mLastReverbIndex
&&
if
(
R
.
id
.
btn_stop_bgm
!=
v
.
getId
()&&
(
v
.
getId
()
==
R
.
id
.
btn_reverb_default
||
v
.
getId
()
==
R
.
id
.
btn_reverb_1
||
v
.
getId
()
==
R
.
id
.
btn_reverb_2
||
v
.
getId
()
==
R
.
id
.
btn_reverb_3
||
v
.
getId
()
==
R
.
id
.
btn_reverb_4
||
v
.
getId
()
==
R
.
id
.
btn_reverb_5
||
v
.
getId
()
==
R
.
id
.
btn_reverb_6
))
{
// 混响
v
.
setBackgroundDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
round_button_3
));
if
(
v
.
getId
()
!=
mLastReverbIndex
){
v
.
setBackgroundDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
round_button_3
));
View
lastV
=
findViewById
(
mLastReverbIndex
);
if
(
null
!=
lastV
)
{
lastV
.
setBackgroundDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
round_button_2
));
}
View
lastV
=
findViewById
(
mLastReverbIndex
);
if
(
null
!=
lastV
)
{
lastV
.
setBackgroundDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
round_button_2
));
}
mLastReverbIndex
=
v
.
getId
();
mLastReverbIndex
=
v
.
getId
();
}
}
else
if
(
R
.
id
.
btn_stop_bgm
!=
v
.
getId
()
&&
v
.
getId
()
!=
mLastVoiceChangerIndex
)
{
// 变声
v
.
setBackgroundDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
round_button_3
));
...
...
This diff is collapsed.
Click to expand it.
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/audience/TCAudienceActivity.java
View file @
f88e6950
...
...
@@ -28,6 +28,7 @@ import android.widget.Toast;
import
com.dayu.livemodule.IMLVBLiveRoomListener
;
import
com.dayu.livemodule.MLVBLiveRoom
;
import
com.dayu.livemodule.R
;
import
com.dayu.livemodule.event.LiveFinishEvent
;
import
com.dayu.livemodule.roomutil.commondef.AnchorInfo
;
import
com.dayu.livemodule.roomutil.commondef.AudienceInfo
;
import
com.dayu.livemodule.roomutil.commondef.MLVBCommonDef
;
...
...
@@ -49,12 +50,15 @@ import com.dayu.livemodule.xiaozhibo.common.widget.video.TCVideoView;
import
com.dayu.livemodule.xiaozhibo.common.widget.video.TCVideoViewMgr
;
import
com.dayu.livemodule.xiaozhibo.login.TCUserMgr
;
import
com.dayu.livemodule.xiaozhibo.main.videolist.ui.TCVideoListFragment
;
import
com.tencent.liteav.basic.log.TXCLog
;
import
com.tencent.liteav.demo.beauty.BeautyPanel
;
import
com.tencent.liteav.demo.beauty.BeautyParams
;
import
com.tencent.rtmp.TXLiveConstants
;
import
com.tencent.rtmp.TXLog
;
import
com.tencent.rtmp.ui.TXCloudVideoView
;
import
org.greenrobot.eventbus.EventBus
;
import
java.io.UnsupportedEncodingException
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
...
...
@@ -138,6 +142,7 @@ public class TCAudienceActivity extends Activity implements IMLVBLiveRoomListene
//分享相关
private
String
mCoverUrl
=
""
;
private
String
mTitle
=
""
;
//标题
private
String
mRoomInfo
=
""
;
//log相关
private
boolean
mShowLog
;
...
...
@@ -178,6 +183,7 @@ public class TCAudienceActivity extends Activity implements IMLVBLiveRoomListene
mFileId
=
intent
.
getStringExtra
(
TCConstants
.
FILE_ID
);
mTimeStamp
=
intent
.
getStringExtra
(
TCConstants
.
TIMESTAMP
);
mTitle
=
intent
.
getStringExtra
(
TCConstants
.
ROOM_TITLE
);
mRoomInfo
=
intent
.
getStringExtra
(
TCConstants
.
ROOM_INFO
);
mUserId
=
TCUserMgr
.
getInstance
().
getUserId
();
mNickname
=
TCUserMgr
.
getInstance
().
getNickname
();
mAvatar
=
TCUserMgr
.
getInstance
().
getAvatar
();
...
...
@@ -355,14 +361,46 @@ public class TCAudienceActivity extends Activity implements IMLVBLiveRoomListene
mLiveRoom
.
enterRoom
(
mGroupId
,
mTXCloudVideoView
,
new
IMLVBLiveRoomListener
.
EnterRoomCallback
()
{
@Override
public
void
onError
(
int
errCode
,
String
errInfo
)
{
showErrorAndQuit
(
"加入房间失败,Error:"
+
errCode
);
if
(
errCode
==
10010
){
showErrorAndQuit
(
"直播已结束"
);
EventBus
.
getDefault
().
post
(
new
LiveFinishEvent
());
}
else
{
showErrorAndQuit
(
"加入房间失败,Error:"
+
errCode
);
}
TCELKReportMgr
.
getInstance
().
reportELK
(
TCConstants
.
ELK_ACTION_LIVE_PLAY
,
TCUserMgr
.
getInstance
().
getUserId
(),
-
10001
,
"进入LiveRoom失败"
,
null
);
}
@Override
public
void
onSuccess
()
{
TXCLog
.
i
(
TAG
,
"startPlay successs "
);
mBgImageView
.
setVisibility
(
View
.
GONE
);
mLiveRoom
.
sendRoomCustomMsg
(
String
.
valueOf
(
TCConstants
.
IMCMD_ENTER_LIVE
),
""
,
null
);
mLiveRoom
.
getAudienceList
(
new
GetAudienceListCallback
()
{
@Override
public
void
onError
(
int
errCode
,
String
errInfo
)
{
TXCLog
.
i
(
TAG
,
"startPlay error "
+
errCode
+
" "
+
errInfo
);
}
@Override
public
void
onSuccess
(
ArrayList
<
AudienceInfo
>
audienceInfoList
)
{
if
(
audienceInfoList
!=
null
&&
mAvatarListAdapter
!=
null
){
int
addedCount
=
0
;
for
(
AudienceInfo
audience
:
audienceInfoList
){
TCSimpleUserInfo
userInfo
=
new
TCSimpleUserInfo
(
audience
.
userID
,
audience
.
userName
,
audience
.
userAvatar
);
if
(
mAvatarListAdapter
.
addItem
(
userInfo
)){
if
(
addedCount
!=
0
){
mCurrentAudienceCount
++;
mMemberCount
.
setText
(
String
.
format
(
Locale
.
CHINA
,
"%d"
,
mCurrentAudienceCount
));
}
addedCount
+=
1
;
}
}
}
}
});
TCELKReportMgr
.
getInstance
().
reportELK
(
TCConstants
.
ELK_ACTION_LIVE_PLAY
,
TCUserMgr
.
getInstance
().
getUserId
(),
10000
,
"进入LiveRoom成功"
,
null
);
}
});
...
...
@@ -462,7 +500,7 @@ public class TCAudienceActivity extends Activity implements IMLVBLiveRoomListene
mLiveRoom
.
getBeautyManager
().
setWhitenessLevel
(
beautyParams
.
mWhiteLevel
);
mLiveRoom
.
getBeautyManager
().
setRuddyLevel
(
beautyParams
.
mRuddyLevel
);
mLiveRoom
.
joinAnchor
(
new
IMLVBLiveRoomListener
.
JoinAnchorCallback
()
{
mLiveRoom
.
joinAnchor
(
mRoomInfo
,
new
IMLVBLiveRoomListener
.
JoinAnchorCallback
()
{
@Override
public
void
onError
(
int
errCode
,
String
errInfo
)
{
stopLinkMic
();
...
...
@@ -669,11 +707,13 @@ public class TCAudienceActivity extends Activity implements IMLVBLiveRoomListene
public
void
onRoomDestroy
(
String
roomID
)
{
stopLinkMic
();
showErrorAndQuit
(
"直播已结束"
);
EventBus
.
getDefault
().
post
(
new
LiveFinishEvent
());
}
@Override
public
void
onError
(
int
errorCode
,
String
errorMessage
,
Bundle
extraInfo
)
{
if
(
errorCode
==
MLVBCommonDef
.
LiveRoomErrorCode
.
ERROR_IM_FORCE_OFFLINE
)
{
// IM 被强制下线。
finish
();
TCUtils
.
showKickOut
(
TCAudienceActivity
.
this
);
}
else
{
showErrorAndQuit
(
"视频流播放失败,Error:"
);
...
...
This diff is collapsed.
Click to expand it.
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/common/utils/TCConstants.java
View file @
f88e6950
...
...
@@ -37,6 +37,7 @@ public class TCConstants {
public
static
final
int
WRITE_PERMISSION_REQ_CODE
=
2
;
public
static
final
int
CAMERA_PERMISSION_REQ_CODE
=
3
;
public
static
final
String
ROOM_INFO
=
"room_info"
;
public
static
final
String
ROOM_TITLE
=
"room_title"
;
public
static
final
String
COVER_PIC
=
"cover_pic"
;
public
static
final
String
GROUP_ID
=
"group_id"
;
...
...
This diff is collapsed.
Click to expand it.
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/common/utils/TCUtils.java
View file @
f88e6950
...
...
@@ -38,7 +38,6 @@ import android.support.v4.content.PermissionChecker;
import
android.text.TextUtils
;
import
android.util.TypedValue
;
import
android.widget.ImageView
;
import
android.widget.Toast
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.RequestManager
;
...
...
@@ -46,9 +45,11 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
import
com.bumptech.glide.load.resource.bitmap.CircleCrop
;
import
com.bumptech.glide.request.RequestOptions
;
import
com.dayu.livemodule.R
;
import
com.dayu.livemodule.
xiaozhibo.login.TCLoginActivity
;
import
com.dayu.livemodule.
event.UserKickOutEvent
;
import
com.dayu.livemodule.xiaozhibo.login.TCUserMgr
;
import
org.greenrobot.eventbus.EventBus
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
...
...
@@ -503,11 +504,12 @@ public class TCUtils {
* @param context activity
*/
public
static
void
showKickOut
(
final
Context
context
)
{
Toast
.
makeText
(
context
,
"您的账号已在其他地方登录,您被迫下线。"
,
Toast
.
LENGTH_SHORT
).
show
();
//
Toast.makeText(context, "您的账号已在其他地方登录,您被迫下线。", Toast.LENGTH_SHORT).show();
TCUserMgr
.
getInstance
().
logout
();
Intent
intent
=
new
Intent
(
context
,
TCLoginActivity
.
class
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
|
Intent
.
FLAG_ACTIVITY_CLEAR_TASK
);
context
.
startActivity
(
intent
);
EventBus
.
getDefault
().
post
(
new
UserKickOutEvent
());
// Intent intent = new Intent(context, TCLoginActivity.class);
// intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
// context.startActivity(intent);
}
/**
...
...
This diff is collapsed.
Click to expand it.
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/common/widget/TCInputTextMsgDialog.java
View file @
f88e6950
...
...
@@ -69,7 +69,7 @@ public class TCInputTextMsgDialog extends Dialog {
messageTextView
.
setText
(
""
);
dismiss
();
}
else
{
Toast
.
makeText
(
mContext
,
"
input can not be empty
!"
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
mContext
,
"
请输入内容
!"
,
Toast
.
LENGTH_LONG
).
show
();
}
messageTextView
.
setText
(
null
);
}
...
...
@@ -115,7 +115,7 @@ public class TCInputTextMsgDialog extends Dialog {
// messageTextView.setText("");
dismiss
();
}
else
{
Toast
.
makeText
(
mContext
,
"
input can not be empty
!"
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
mContext
,
"
请输入内容
!"
,
Toast
.
LENGTH_LONG
).
show
();
}
return
true
;
case
KeyEvent
.
KEYCODE_BACK
:
...
...
@@ -140,7 +140,7 @@ public class TCInputTextMsgDialog extends Dialog {
messageTextView
.
setText
(
""
);
dismiss
();
}
else
{
Toast
.
makeText
(
mContext
,
"
input can not be empty
!"
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
mContext
,
"
请输入内容
!"
,
Toast
.
LENGTH_LONG
).
show
();
}
messageTextView
.
setText
(
null
);
}
...
...
This diff is collapsed.
Click to expand it.
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/common/widget/TCUserAvatarListAdapter.java
View file @
f88e6950
...
...
@@ -6,7 +6,6 @@ import android.view.LayoutInflater;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
android.widget.Toast
;
import
com.dayu.livemodule.R
;
import
com.dayu.livemodule.xiaozhibo.common.msg.TCSimpleUserInfo
;
...
...
@@ -28,6 +27,9 @@ public class TCUserAvatarListAdapter extends RecyclerView.Adapter<RecyclerView.V
//最大容纳量
private
final
static
int
TOP_STORGE_MEMBER
=
50
;
public
LinkedList
<
TCSimpleUserInfo
>
getmUserAvatarList
()
{
return
mUserAvatarList
;
}
public
TCUserAvatarListAdapter
(
Context
context
,
String
pusherId
)
{
this
.
mContext
=
context
;
...
...
@@ -87,7 +89,7 @@ public class TCUserAvatarListAdapter extends RecyclerView.Adapter<RecyclerView.V
@Override
public
void
onClick
(
View
view
)
{
TCSimpleUserInfo
userInfo
=
mUserAvatarList
.
get
(
avatarViewHolder
.
getAdapterPosition
());
Toast
.
makeText
(
mContext
.
getApplicationContext
(),
"当前点击用户: "
+
userInfo
.
userid
,
Toast
.
LENGTH_SHORT
).
show
();
//
Toast.makeText(mContext.getApplicationContext(),"当前点击用户: " + userInfo.userid, Toast.LENGTH_SHORT).show();
}
});
...
...
This diff is collapsed.
Click to expand it.
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/main/videolist/utils/TCVideoInfo.java
View file @
f88e6950
...
...
@@ -23,6 +23,7 @@ public class TCVideoInfo {
public
String
avatar
;
// 头像
public
String
createTime
;
// 开播时间
public
String
hlsPlayUrl
;
// HLS播放链接
public
String
roomInfo
;
// HLS播放链接
public
TCVideoInfo
()
{}
...
...
This diff is collapsed.
Click to expand it.
liveModule/src/main/java/com/dayu/livemodule/xiaozhibo/main/videolist/utils/TCVideoListMgr.java
View file @
f88e6950
...
...
@@ -16,15 +16,15 @@ import org.json.JSONObject;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Module: TCVideoListMgr
*
* Function: 获取当前正在直播的房间列表或者视频回放列表
*
* 1. 获取当前正在直播的列表,通过 MLVB 组件获取正在直播的房间列表。 {@link TCVideoListMgr#fetchLiveList(Context, Listener)}
*
* 2. 获取回放视频的列表,向您部署的小直播后台发起获取视频回放的列表。{@link TCVideoListMgr#fetchVodList(Listener)} (Context)}
*
* Module: TCVideoListMgr
* <p>
* Function: 获取当前正在直播的房间列表或者视频回放列表
* <p>
* 1. 获取当前正在直播的列表,通过 MLVB 组件获取正在直播的房间列表。 {@link TCVideoListMgr#fetchLiveList(Context, Listener)}
* <p>
* 2. 获取回放视频的列表,向您部署的小直播后台发起获取视频回放的列表。{@link TCVideoListMgr#fetchVodList(Listener)} (Context)}
*/
public
class
TCVideoListMgr
{
private
static
final
String
TAG
=
TCVideoListMgr
.
class
.
getSimpleName
();
...
...
@@ -51,7 +51,7 @@ public class TCVideoListMgr {
if
(
listener
!=
null
)
{
listener
.
onVideoList
(
errCode
,
null
,
false
);
}
TXLog
.
w
(
TAG
,
"xzb_process: get_live_list error, code:"
+
errCode
+
", errInfo:"
+
errInfo
);
TXLog
.
w
(
TAG
,
"xzb_process: get_live_list error, code:"
+
errCode
+
", errInfo:"
+
errInfo
);
}
@Override
...
...
@@ -61,28 +61,27 @@ public class TCVideoListMgr {
for
(
RoomInfo
value
:
data
)
{
List
<
AnchorInfo
>
pushers
=
value
.
pushers
;
String
envStr
=
""
;
TCVideoInfo
info
=
new
TCVideoInfo
();
info
.
playUrl
=
value
.
mixedPlayURL
;
info
.
title
=
value
.
roomName
;
info
.
title
=
value
.
roomName
;
info
.
userId
=
value
.
roomCreator
;
info
.
groupId
=
value
.
roomID
;
info
.
viewerCount
=
value
.
audienceCount
;
info
.
livePlay
=
true
;
info
.
viewerCount
=
value
.
audienceCount
;
info
.
livePlay
=
true
;
info
.
roomInfo
=
value
.
roomInfo
;
if
(
pushers
!=
null
&&
!
pushers
.
isEmpty
())
{
AnchorInfo
pusher
=
pushers
.
get
(
0
);
info
.
nickname
=
pusher
.
userName
;
info
.
avatar
=
pusher
.
userAvatar
;
info
.
nickname
=
pusher
.
userName
;
info
.
avatar
=
pusher
.
userAvatar
;
}
try
{
JSONObject
jsonRoomInfo
=
new
JSONObject
(
value
.
roomInfo
);
info
.
title
=
jsonRoomInfo
.
optString
(
"title"
);
info
.
title
=
jsonRoomInfo
.
optString
(
"title"
);
info
.
frontCover
=
jsonRoomInfo
.
optString
(
"frontcover"
);
info
.
location
=
jsonRoomInfo
.
optString
(
"location"
);
// if (!TextUtils.isEmpty(jsonRoomInfo.optString("playurl"))){
// info.playUrl = jsonRoomInfo.optString("playurl");
// value.mixedPlayURL = jsonRoomInfo.optString("playurl");
// }
info
.
location
=
jsonRoomInfo
.
optString
(
"location"
);
envStr
=
jsonRoomInfo
.
optString
(
TCGlobalConfig
.
LIVE_ENVIRONMENT
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
if
(!
TextUtils
.
isEmpty
(
value
.
roomInfo
))
{
...
...
@@ -92,18 +91,18 @@ public class TCVideoListMgr {
try
{
JSONObject
jsonCunstomInfo
=
new
JSONObject
(
value
.
custom
);
info
.
likeCount
=
jsonCunstomInfo
.
optInt
(
"praise"
);
info
.
likeCount
=
jsonCunstomInfo
.
optInt
(
"praise"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
infos
.
add
(
info
);
if
(
envStr
.
equals
(
TCGlobalConfig
.
ENVIRONMENT
))
infos
.
add
(
info
);
}
}
if
(
listener
!=
null
)
{
listener
.
onVideoList
(
0
,
infos
,
true
);
}
TXLog
.
w
(
TAG
,
"xzb_process: get_live_list success "
+
infos
.
size
());
TXLog
.
w
(
TAG
,
"xzb_process: get_live_list success "
+
infos
.
size
());
}
});
}
...
...
@@ -115,7 +114,7 @@ public class TCVideoListMgr {
*/
public
void
fetchVodList
(
final
Listener
listener
)
{
try
{
JSONObject
body
=
new
JSONObject
().
put
(
"index"
,
"0"
).
put
(
"count"
,
PAGE_SIZE
);
JSONObject
body
=
new
JSONObject
().
put
(
"index"
,
"0"
).
put
(
"count"
,
PAGE_SIZE
);
TCHTTPMgr
.
getInstance
().
requestWithSign
(
TCGlobalConfig
.
APP_SVR_URL
+
"/get_vod_list"
,
body
,
new
TCHTTPMgr
.
Callback
()
{
@Override
public
void
onSuccess
(
JSONObject
data
)
{
...
...
@@ -123,10 +122,10 @@ public class TCVideoListMgr {
if
(
data
!=
null
)
{
JSONArray
list
=
data
.
optJSONArray
(
"list"
);
if
(
list
!=
null
)
{
for
(
int
i
=
0
;
i
<
list
.
length
();
i
++)
{
for
(
int
i
=
0
;
i
<
list
.
length
();
i
++)
{
JSONObject
obj
=
list
.
optJSONObject
(
i
);
if
(
obj
!=
null
)
{
TCVideoInfo
video
=
new
TCVideoInfo
(
obj
);
TCVideoInfo
video
=
new
TCVideoInfo
(
obj
);
videoList
.
add
(
video
);
}
}
...
...
@@ -150,7 +149,6 @@ public class TCVideoListMgr {
}
/**
* 视频列表获取结果回调
*/
...
...
This diff is collapsed.
Click to expand it.
liveModule/src/main/res/layout/activity_audience.xml
View file @
f88e6950
...
...
@@ -225,6 +225,7 @@
</FrameLayout>
<FrameLayout
android:visibility=
"gone"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
>
...
...
@@ -292,7 +293,8 @@
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"10dp"
android:layout_alignParentBottom=
"true"
android:visibility=
"gone"
>
android:visibility=
"gone"
>
<ProgressBar
android:layout_width=
"match_parent"
android:layout_height=
"5dp"
...
...
This diff is collapsed.
Click to expand it.
liveModule/src/main/res/layout/activity_camera_anchor.xml
View file @
f88e6950
...
...
@@ -249,7 +249,8 @@
android:orientation=
"horizontal"
android:weightSum=
"10"
android:id=
"@+id/anchor_ll_audio_plugin"
android:visibility=
"gone"
>
android:visibility=
"gone"
>
<Button
android:layout_width=
"0dp"
android:layout_weight=
"5"
...
...
This diff is collapsed.
Click to expand it.
liveModule/src/main/res/values/strings.xml
View file @
f88e6950
...
...
@@ -36,7 +36,7 @@
<!-- permission check-->
<string
name=
"float_window_not_allow"
>
悬浮窗权限未开启 请在应用-权限中打开悬浮窗权限
</string>
<string
name=
"dialog_input_text_hint"
>
开启弹幕互动
吧
</string>
<string
name=
"dialog_input_text_hint"
>
和大家说点什么
吧
</string>
<string
name=
"dialog_selectSex"
>
请选择
</string>
<!-- live fragment-->
...
...
This diff is collapsed.
Click to expand it.
liveModule/src/main/res/values/styles.xml
View file @
f88e6950
...
...
@@ -45,6 +45,7 @@
<style
name=
"PlayerTheme"
parent=
"Theme.AppCompat.Light.NoActionBar"
>
<item
name=
"android:windowAnimationStyle"
>
@style/PlayerAnimation
</item>
<item
name=
"android:windowNoTitle"
>
true
</item>
</style>
<style
name=
"PlayerAnimation"
parent=
"android:Animation.Activity"
>
...
...
This diff is collapsed.
Click to expand it.
provider/src/main/java/com/dayu/provider/router/RouterPath.java
View file @
f88e6950
...
...
@@ -26,6 +26,10 @@ public class RouterPath {
* 我的模块.
*/
public
final
static
String
PATH_CERTIFICAITON
=
"/user/certificaiton"
;
/**
* 学习模块.
*/
public
final
static
String
PATH_PREPARELIVE
=
"/learn/prepare_live"
;
/**
* 店长模块
...
...
This diff is collapsed.
Click to expand it.
userCenter/src/main/java/com/dayu/usercenter/data/protocol/EngineerInfo.java
View file @
f88e6950
...
...
@@ -34,6 +34,15 @@ public class EngineerInfo extends BaseObservable implements Serializable {
private
Object
providerTypeList
;
private
Object
messageCheckcode
;
private
String
invitationCode
;
private
int
liveStatus
;
public
int
getLiveStatus
()
{
return
liveStatus
;
}
public
void
setLiveStatus
(
int
liveStatus
)
{
this
.
liveStatus
=
liveStatus
;
}
public
String
getInvitationCode
()
{
return
invitationCode
;
...
...
This diff is collapsed.
Click to expand it.
userCenter/src/main/java/com/dayu/usercenter/ui/fragment/HomeUserFragment.java
View file @
f88e6950
package
com
.
dayu
.
usercenter
.
ui
.
fragment
;
import
android.content.ClipData
;
import
android.content.ClipboardManager
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.os.Bundle
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
...
...
@@ -74,6 +72,7 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
// mPresenter.getAlipayAccount(userId);
mBind
.
refreshLayout
.
setEnableLoadMore
(
false
);
mBind
.
refreshLayout
.
setOnRefreshListener
(
refreshLayout
->
mPresenter
.
getAllData
(
mUserId
));
mBind
.
tvStartLive
.
setOnClickListener
(
view
->
ARouter
.
getInstance
().
build
(
RouterPath
.
PATH_PREPARELIVE
).
navigation
());
}
@Override
...
...
@@ -96,6 +95,8 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
@Override
public
void
getPersonalInfoSuccess
(
EngineerInfo
info
)
{
// mBind.tvStartLive.setVisibility(View.VISIBLE);
mBind
.
tvStartLive
.
setVisibility
(
info
.
getLiveStatus
()
==
1
?
View
.
VISIBLE
:
View
.
GONE
);
if
(
TextUtils
.
isEmpty
(
info
.
getIdentity
()))
{
SPUtils
.
put
(
"USER_IDENTITY"
,
""
);
}
else
{
...
...
@@ -130,6 +131,7 @@ public class HomeUserFragment extends BaseFragment<HomeUserPresenter, FragmentHo
UserInfo
userInfo
=
UserManager
.
getInstance
().
getUser
();
if
(
userInfo
!=
null
)
{
userInfo
.
setHeaderImg
(
info
.
getAccountUrl
());
userInfo
.
setLiveStatus
(
info
.
getLiveStatus
());
UserManager
.
getInstance
().
saveUser
(
userInfo
);
}
}
...
...
This diff is collapsed.
Click to expand it.
userCenter/src/main/res/layout/fragment_home_user.xml
View file @
f88e6950
...
...
@@ -16,6 +16,16 @@
<RelativeLayout
android:id=
"@+id/rl_title"
style=
"@style/title"
>
<TextView
android:visibility=
"gone"
android:id=
"@+id/tv_start_live"
android:layout_width=
"100dp"
android:layout_height=
"match_parent"
android:textColor=
"@color/common_text_color"
android:textSize=
"16sp"
android:gravity=
"center"
android:text=
"开始直播"
/>
<TextView
style=
"@style/text_title"
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment