Skip to content

Commit

Permalink
v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ktomcat committed Jun 14, 2019
1 parent d565229 commit 57ca831
Show file tree
Hide file tree
Showing 46 changed files with 1,840 additions and 214 deletions.
Binary file modified StarRTC_demo.apk
Binary file not shown.
Binary file modified demo/app/libs/armeabi-v7a/libstarRTC.so
Binary file not shown.
Binary file modified demo/app/libs/star_rtc_sdk.jar
Binary file not shown.
11 changes: 11 additions & 0 deletions demo/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,17 @@
android:name=".demo.videomeeting.VideoMeetingCreateActivity"
android:screenOrientation="portrait" />

<!-- 超级聊天室 -->
<activity
android:name=".demo.superroom.SuperRoomActivity"
android:screenOrientation="portrait" />
<activity
android:name=".demo.superroom.SuperRoomCreateActivity"
android:screenOrientation="portrait" />
<activity
android:name=".demo.superroom.SuperRoomListActivity"
android:screenOrientation="portrait" />

<!-- 测试 -->
<activity
android:name=".demo.test.LoopTestActivity"
Expand Down
13 changes: 11 additions & 2 deletions demo/app/src/main/java/com/starrtc/demo/demo/MLOC.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,21 @@ public class MLOC {
public static final int CHATROOM_LIST_TYPE_MEETING_PUSH = 4;
public static final int CHATROOM_LIST_TYPE_CLASS = 5;
public static final int CHATROOM_LIST_TYPE_CLASS_PUSH = 6;
public static final int CHATROOM_LIST_TYPE_AUDIO_LIVE = 7;
public static final int CHATROOM_LIST_TYPE_AUDIO_LIVE_PUSH = 8;
public static final int CHATROOM_LIST_TYPE_SUPER_ROOM = 9;
public static final int CHATROOM_LIST_TYPE_SUPER_ROOM_PUSH = 10;

public static final String CHATROOM_LIST_TYPE_LIVE_ALL = CHATROOM_LIST_TYPE_LIVE+","+CHATROOM_LIST_TYPE_LIVE_PUSH;
public static final String CHATROOM_LIST_TYPE_MEETING_ALL = CHATROOM_LIST_TYPE_MEETING+","+CHATROOM_LIST_TYPE_MEETING_PUSH;
public static final String CHATROOM_LIST_TYPE_CLASS_ALL = CHATROOM_LIST_TYPE_CLASS+","+CHATROOM_LIST_TYPE_CLASS_PUSH;
public static final String CHATROOM_LIST_TYPE_PUSH_ALL = CHATROOM_LIST_TYPE_LIVE_PUSH+","+CHATROOM_LIST_TYPE_MEETING_PUSH+","+CHATROOM_LIST_TYPE_CLASS_PUSH;

public static final String CHATROOM_LIST_TYPE_AUDIO_LIVE_ALL = CHATROOM_LIST_TYPE_AUDIO_LIVE+","+CHATROOM_LIST_TYPE_AUDIO_LIVE_PUSH;
public static final String CHATROOM_LIST_TYPE_SUPER_ROOM_ALL = CHATROOM_LIST_TYPE_SUPER_ROOM+","+CHATROOM_LIST_TYPE_SUPER_ROOM_PUSH;
public static final String CHATROOM_LIST_TYPE_PUSH_ALL = CHATROOM_LIST_TYPE_LIVE_PUSH
+","+CHATROOM_LIST_TYPE_MEETING_PUSH
+","+CHATROOM_LIST_TYPE_CLASS_PUSH
+","+CHATROOM_LIST_TYPE_AUDIO_LIVE_PUSH
+","+CHATROOM_LIST_TYPE_SUPER_ROOM_PUSH;
public static Boolean hasLogout = false;

public static boolean hasNewC2CMsg = false;
Expand Down
17 changes: 0 additions & 17 deletions demo/app/src/main/java/com/starrtc/demo/demo/SplashActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
Expand All @@ -23,25 +20,11 @@
import android.view.animation.Animation;

import com.starrtc.demo.R;
import com.starrtc.demo.demo.beauty.DemoBeautyCallback;
import com.starrtc.demo.demo.service.KeepLiveService;
import com.starrtc.demo.listener.XHVoipP2PManagerListener;
import com.starrtc.demo.serverAPI.InterfaceUrls;
import com.starrtc.demo.utils.AEvent;
import com.starrtc.demo.utils.IEventListener;
import com.starrtc.demo.listener.XHChatManagerListener;
import com.starrtc.starrtcsdk.api.XHClient;
import com.starrtc.demo.listener.XHGroupManagerListener;
import com.starrtc.demo.listener.XHLoginManagerListener;
import com.starrtc.starrtcsdk.api.XHCustomConfig;
import com.starrtc.demo.listener.XHVoipManagerListener;
import com.starrtc.starrtcsdk.apiInterface.IXHErrorCallback;
import com.starrtc.starrtcsdk.apiInterface.IXHResultCallback;
import com.starrtc.starrtcsdk.core.beauty.XHBeautyManager;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class SplashActivity extends Activity {
private boolean isLogin = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.starrtc.demo.demo.im.IMDemoActivity;
import com.starrtc.demo.demo.miniclass.MiniClassListActivity;
import com.starrtc.demo.demo.setting.SettingActivity;
import com.starrtc.demo.demo.superroom.SuperRoomListActivity;
import com.starrtc.demo.demo.videolive.VideoLiveListActivity;
import com.starrtc.demo.demo.videomeeting.VideoMeetingListActivity;
import com.starrtc.demo.demo.voip.VoipListActivity;
Expand Down Expand Up @@ -95,7 +96,7 @@ public void onClick(View v) {
startActivity(intent8);
break;
case R.id.btn_main_audio:
Intent intent9= new Intent(this, AudioLiveListActivity.class);
Intent intent9= new Intent(this, SuperRoomListActivity.class);
startActivity(intent9);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import org.json.JSONException;
import org.json.JSONObject;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -88,7 +90,7 @@ protected void onCreate(Bundle savedInstanceState) {
starRTCAudioManager = StarRTCAudioManager.create(this);
starRTCAudioManager.start(new StarRTCAudioManager.AudioManagerEvents() {
@Override
public void onAudioDeviceChanged(StarRTCAudioManager.AudioDevice selectedAudioDevice, Set<StarRTCAudioManager.AudioDevice> availableAudioDevices) {
public void onAudioDeviceChanged(StarRTCAudioManager.AudioDevice selectedAudioDevice, Set availableAudioDevices) {

}
});
Expand Down Expand Up @@ -303,8 +305,25 @@ private void createNewLive(){
@Override
public void success(Object data) {
liveId = (String) data;
InterfaceUrls.demoReportAudioLive(liveId,liveName,createrId);
if(MLOC.SERVER_TYPE.equals(MLOC.SERVER_TYPE_PUBLIC)){
InterfaceUrls.demoReportAudioLive(liveId,liveName,createrId);
}else{
try {
JSONObject info = new JSONObject();
info.put("id",liveId);
info.put("creator",MLOC.userId);
info.put("name",liveName);
String infostr = info.toString();
infostr = URLEncoder.encode(infostr,"utf-8");
liveManager.saveToList(MLOC.userId,MLOC.CHATROOM_LIST_TYPE_AUDIO_LIVE,liveId,infostr,null);
} catch (JSONException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
starLive();

}
@Override
public void failed(final String errMsg) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,12 @@ public void onClick(View v) {
finish();
}
});
findViewById(R.id.switch_type).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
findViewById(R.id.switch_type).setSelected(!findViewById(R.id.switch_type).isSelected());
}
});
findViewById(R.id.yes_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String inputId = ((EditText)findViewById(R.id.targetid_input)).getText().toString();
XHConstants.XHLiveType type =
findViewById(R.id.switch_type).isSelected()?
XHConstants.XHLiveType.XHLiveTypeGlobalPublic:
XHConstants.XHLiveType.XHLiveTypeLoginPublic;
XHConstants.XHLiveType type = XHConstants.XHLiveType.XHLiveTypeGlobalPublic;

if(TextUtils.isEmpty(inputId)){
MLOC.showMsg(AudioLiveCreateActivity.this,"id不能为空");
}else{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

public class AudioLiveInfo {
public String createrId;
public String liveName;
public String liveId;
public String creator;
public String name;
public String id;
public String isLiveOn;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,19 @@

import com.starrtc.demo.R;
import com.starrtc.demo.demo.BaseActivity;
import com.starrtc.demo.demo.MLOC;
import com.starrtc.demo.serverAPI.InterfaceUrls;
import com.starrtc.demo.ui.CircularCoverView;
import com.starrtc.demo.utils.AEvent;
import com.starrtc.demo.utils.ColorUtils;
import com.starrtc.demo.utils.DensityUtils;
import com.starrtc.demo.utils.StarListUtil;
import com.starrtc.starrtcsdk.api.XHClient;
import com.starrtc.starrtcsdk.apiInterface.IXHResultCallback;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;

Expand Down Expand Up @@ -82,18 +89,6 @@ public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleI
});
}

@Override
public void onResume(){
super.onResume();
AEvent.addListener(AEvent.AEVENT_AUDIO_LIVE_GOT_LIST,this);
InterfaceUrls.demoRequestAudioLiveList();
}
@Override
public void onPause(){
AEvent.removeListener(AEvent.AEVENT_AUDIO_LIVE_GOT_LIST,this);
super.onPause();
}

@Override
public void dispatchEvent(String aEventID, final boolean success, final Object eventObj) {
super.dispatchEvent(aEventID,success,eventObj);
Expand Down Expand Up @@ -124,18 +119,69 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
AudioLiveInfo clickLiveInfo = mDatas.get(position);

Intent intent = new Intent(AudioLiveListActivity.this, AudioLiveActivity.class);
intent.putExtra(AudioLiveActivity.LIVE_NAME,clickLiveInfo.liveName);
intent.putExtra(AudioLiveActivity.CREATER_ID,clickLiveInfo.createrId);
intent.putExtra(AudioLiveActivity.LIVE_ID,clickLiveInfo.liveId);
intent.putExtra(AudioLiveActivity.LIVE_NAME,clickLiveInfo.name);
intent.putExtra(AudioLiveActivity.CREATER_ID,clickLiveInfo.creator);
intent.putExtra(AudioLiveActivity.LIVE_ID,clickLiveInfo.id);
startActivity(intent);

}

@Override
public void onResume(){
super.onResume();
if(MLOC.SERVER_TYPE.equals(MLOC.SERVER_TYPE_PUBLIC)){
AEvent.addListener(AEvent.AEVENT_AUDIO_LIVE_GOT_LIST,this);
}
onRefresh();
}

@Override
public void onPause(){
super.onPause();
if(MLOC.SERVER_TYPE.equals(MLOC.SERVER_TYPE_PUBLIC)) {
AEvent.removeListener(AEvent.AEVENT_AUDIO_LIVE_GOT_LIST, this);
}
super.onStop();
}
@Override
public void onRefresh() {
InterfaceUrls.demoRequestAudioLiveList();
if(MLOC.SERVER_TYPE.equals(MLOC.SERVER_TYPE_PUBLIC)){
InterfaceUrls.demoRequestAudioLiveList();
}else{
queryAllList();
}
}
private void queryAllList(){
XHClient.getInstance().getLiveManager().queryList("",MLOC.CHATROOM_LIST_TYPE_AUDIO_LIVE_ALL,new IXHResultCallback() {
@Override
public void success(final Object data) {
refreshLayout.setRefreshing(false);
mDatas.clear();
try {
JSONArray array = (JSONArray) data;
for(int i = array.length()-1;i>=0;i--){
AudioLiveInfo info = new AudioLiveInfo();
JSONObject obj = array.getJSONObject(i);
info.creator = obj.getString("creator");
info.id = obj.getString("id");
info.name = obj.getString("name");
mDatas.add(info);
}
myListAdapter.notifyDataSetChanged();
} catch (JSONException e) {
e.printStackTrace();
}
}

@Override
public void failed(String errMsg) {
MLOC.d("VideoMettingListActivity",errMsg);
refreshLayout.setRefreshing(false);
mDatas.clear();
myListAdapter.notifyDataSetChanged();
}
});
}

class MyListAdapter extends BaseAdapter{
@Override
Expand Down Expand Up @@ -169,11 +215,16 @@ public View getView(int position, View convertView, ViewGroup parent) {
}else{
viewIconImg = (ViewHolder)convertView.getTag();
}
viewIconImg.vRoomName.setText(mDatas.get(position).liveName);
viewIconImg.vCreaterId.setText(mDatas.get(position).createrId);
viewIconImg.vHeadBg.setBackgroundColor(ColorUtils.getColor(AudioLiveListActivity.this,mDatas.get(position).liveName));
viewIconImg.vRoomName.setText(mDatas.get(position).name);
viewIconImg.vCreaterId.setText(mDatas.get(position).creator);
viewIconImg.vHeadBg.setBackgroundColor(ColorUtils.getColor(AudioLiveListActivity.this,mDatas.get(position).name));
viewIconImg.vHeadCover.setCoverColor(Color.parseColor("#FFFFFF"));
viewIconImg.vLiveState.setVisibility(mDatas.get(position).isLiveOn.equals("1")?View.VISIBLE:View.INVISIBLE);
if(mDatas.get(position).isLiveOn!=null){
viewIconImg.vLiveState.setVisibility(mDatas.get(position).isLiveOn.equals("1")?View.VISIBLE:View.INVISIBLE);
}else{
viewIconImg.vLiveState.setVisibility(View.INVISIBLE);
}

int cint = DensityUtils.dip2px(AudioLiveListActivity.this,28);
viewIconImg.vHeadCover.setRadians(cint, cint, cint, cint,0);
viewIconImg.vHeadImage.setImageResource(R.drawable.icon_main_mic);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.starrtc.demo.demo.beauty;

import com.starrtc.demo.demo.MLOC;
import com.starrtc.starrtcsdk.core.videosrc.StarAudioData;
import com.starrtc.starrtcsdk.core.videosrc.XHVideoSourceCallback;
import com.starrtc.starrtcsdk.core.videosrc.StarVideoData;

public class DemoVideoSourceCallback extends XHVideoSourceCallback {
@Override
public StarVideoData onVideoFrame(StarVideoData videoData){
MLOC.d("DemoVideoSourceCallback","视频源数据已经接到了,不做处理,直接再丢回去"+videoData.getDataLength());
//可直接对videoData里的数据进行处理,处理后将videoData对象返回即可。
return videoData;
}
@Override
public StarAudioData onAudioFrame(StarAudioData audioData){
MLOC.d("DemoVideoSourceCallback","音频源数据已经接到了,不做处理,直接再丢回去"+audioData.getDataLength());
//可直接对audioData里的数据进行处理,处理后将audioData对象返回即可。
return audioData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,11 @@ public void onClick(View v) {
finish();
}
});
findViewById(R.id.switch_type).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
findViewById(R.id.switch_type).setSelected(!findViewById(R.id.switch_type).isSelected());
}
});
findViewById(R.id.yes_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String inputId = ((EditText)findViewById(R.id.targetid_input)).getText().toString();
XHConstants.XHChatroomType type =
findViewById(R.id.switch_type).isSelected()?
XHConstants.XHChatroomType.XHChatroomTypePublic:
XHConstants.XHChatroomType.XHChatroomTypeLogin;
XHConstants.XHChatroomType type = XHConstants.XHChatroomType.XHChatroomTypePublic;
if(TextUtils.isEmpty(inputId)){
MLOC.showMsg(ChatroomCreateActivity.this,"id不能为空");
}else{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected void onCreate(Bundle savedInstanceState) {
starRTCAudioManager = StarRTCAudioManager.create(this);
starRTCAudioManager.start(new StarRTCAudioManager.AudioManagerEvents() {
@Override
public void onAudioDeviceChanged(StarRTCAudioManager.AudioDevice selectedAudioDevice, Set<StarRTCAudioManager.AudioDevice> availableAudioDevices) {
public void onAudioDeviceChanged(StarRTCAudioManager.AudioDevice selectedAudioDevice, Set availableAudioDevices) {

}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,10 @@ public void onClick(View v) {
finish();
}
});
findViewById(R.id.switch_type).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
findViewById(R.id.switch_type).setSelected(!findViewById(R.id.switch_type).isSelected());
}
});
findViewById(R.id.yes_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String inputId = ((EditText)findViewById(R.id.targetid_input)).getText().toString();
// XHConstants.XHMeetingType type =
// findViewById(R.id.switch_type).isSelected()?
// XHConstants.XHMeetingType.XHMeetingTypeGlobalPublic:
// XHConstants.XHMeetingType.XHMeetingTypeLoginPublic;
XHConstants.XHLiveType type = XHConstants.XHLiveType.XHLiveTypeGlobalPublic;

if(TextUtils.isEmpty(inputId)){
Expand Down
Loading

0 comments on commit 57ca831

Please sign in to comment.