0
を受けていない私はquickblox
を使用し、着信ビデオ通話をquickbloxためのビデオ通話アンドロイド:
スタートコールの仕事を作成するが、着信サービスは、相手のユーザーのために
VideoActivity
public class VideoActivity extends E implements QBRTCClientSessionCallbacks,QBRTCClientVideoTracksCallbacks {
private int userid;
private Boolean isOutgoing,micE=true,vidE=true;
private QBRTCSurfaceView surfaceView,remoteview;
private MediaPlayer mp;
private QBRTCSession currentsession;
private QBMediaStreamManager mediaStreamManager;
private ImageView mic,video;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video);
userid=getIntent().getIntExtra("user", 1);
userid = 39753771;
isOutgoing=getIntent().getBooleanExtra("isoutgoing",false);
isOutgoing = true;
ProcessCalls();
InitSignalling();
if (isOutgoing) {
//CallUser();
SetCallerName(userid);
}
Log.i("errorCheck", "Nz: " + userid);
Log.i("errorCheck", "Na: " + isOutgoing);
if(getIntent().getBooleanExtra("service",false)){
Log.i("errorCheck", "x");
}
mic=(ImageView)findViewById(R.id.mic);
mic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (micE) {
micE = false;
AudioManage();
} else {
micE = true;
AudioManage();
}
}
});
video=(ImageView)findViewById(R.id.video);
video.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (vidE) {
vidE = false;
VideoManage();
} else {
vidE = true;
VideoManage();
}
}
});
surfaceView =(QBRTCSurfaceView)findViewById(R.id.localView);
surfaceView.setMirror(true);
surfaceView.requestLayout();
remoteview=(QBRTCSurfaceView)findViewById(R.id.opponentView);
remoteview.requestLayout();
}
private void SetCallerName(Integer callerID) {
TextView callerName=(TextView)findViewById(R.id.callername);
TextView callertime=(TextView)findViewById(R.id.callTime);
callerName.setText(callerID + " , You:");
if(isOutgoing){
callertime.setText("Calling...");
}
}
private void InitSignalling() {
final QBChatService chatService = QBChatService.getInstance();
Log.i("errorCheck", "ERR1: " + G.userQB);
chatService.login(G.userQB, new QBEntityCallback() {
@Override
public void onSuccess(Object result, Bundle params) {
Log.i("errorCheck", "R0: " + result);
Log.i("errorCheck", "R1: " + params);
chatService.getVideoChatWebRTCSignalingManager().addSignalingManagerListener(new QBVideoChatSignalingManagerListener() {
@Override
public void signalingCreated(QBSignaling qbSignaling, boolean createdLocally) {
Log.i("errorCheck", "Q1: " + qbSignaling);
Log.i("errorCheck", "Q2: " + createdLocally);
if (!createdLocally) {
QBRTCClient.getInstance(VideoActivity.this).addSignaling((QBWebRTCSignaling) qbSignaling);
}
}
});
QBRTCClient.getInstance(G.currentActivity).addSessionCallbacksListener((QBRTCSessionEventsCallback) G.currentActivity);
QBRTCConfig.setDebugEnabled(true);
QBRTCClient.getInstance(getApplicationContext()).prepareToProcessCalls();
Log.i("errorCheck", "chatService1: " + chatService);
if(G.userMobile.equals("09139479548")) {
CallUser();
}
}
@Override
public void onError(QBResponseException errors) {
Log.i("errorCheck", "E1: " + errors);
}
});
}
private void ProcessCalls() {
QBRTCClient.getInstance(this).prepareToProcessCalls();
}
private void CallUser() {
List<Integer> opponents = new ArrayList<Integer>();
opponents.add(userid);
Map<String, String> userInfo = new HashMap<>();
userInfo.put("key", "value");
QBRTCTypes.QBConferenceType qbConferenceType = QBRTCTypes.QBConferenceType.QB_CONFERENCE_TYPE_VIDEO;
QBRTCSession session = QBRTCClient.getInstance(G.currentActivity).createNewSessionWithOpponents(opponents, qbConferenceType);
session.addVideoTrackCallbacksListener(this);
session.startCall(userInfo);
Log.i("errorCheck", "QR1: " + session);
SetCallButtonsDialing(session,userInfo);
StartDialRinging();
}
@Override
public void onReceiveNewSession(QBRTCSession qbrtcSession) {
Log.i("errorCheck","x");
qbrtcSession.addVideoTrackCallbacksListener(this);
Map<String,String> userInfo = qbrtcSession.getUserInfo();
SetLayoutForReceiveCall(qbrtcSession,userInfo);
}
private void SetLayoutForReceiveCall(final QBRTCSession qbrtcSession,final Map<String, String> userInfo) {
final FrameLayout receive=(FrameLayout)findViewById(R.id.answerlayout);
receive.setVisibility(View.VISIBLE);
qbrtcSession.addVideoTrackCallbacksListener(this);
final ImageView calll=(ImageView)findViewById(R.id.answerCall);
calll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Accept incoming call
qbrtcSession.acceptCall(userInfo);
receive.setVisibility(View.GONE);
SetCallButtonsDialing(qbrtcSession, userInfo);
StartTimer();
if (mp != null && mp.isPlaying()) {
mp.stop();
}
}
});
findViewById(R.id.rejectcall).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
qbrtcSession.rejectCall(userInfo);
VideoActivity.this.finish();
if(mp!=null&&mp.isPlaying())
{
mp.stop();
}
}
});
}
@Override
public void onUserNoActions(QBRTCSession qbrtcSession, Integer integer) {
Toast.makeText(this, "no action by user", Toast.LENGTH_SHORT).show();
if(mp!=null&&mp.isPlaying())
{
mp.stop();
}
}
@Override
public void onSessionStartClose(QBRTCSession qbrtcSession) {
qbrtcSession.addVideoTrackCallbacksListener(this);
try {
qbrtcSession.getMediaStreamManager().setVideoCapturer(new QBRTCCameraVideoCapturer(this, null));
mediaStreamManager = qbrtcSession.getMediaStreamManager();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onUserNotAnswer(QBRTCSession qbrtcSession, Integer integer) {
Toast.makeText(this, "No answer", Toast.LENGTH_SHORT).show();
if(mp!=null&&mp.isPlaying())
{
mp.stop();
}
finish();
}
@Override
public void onCallRejectByUser(QBRTCSession qbrtcSession, Integer integer, Map<String, String> map) {
Toast.makeText(this, "Call rejected", Toast.LENGTH_SHORT).show();
if(mp!=null&&mp.isPlaying())
{
mp.stop();
}
finish();
}
@Override
public void onCallAcceptByUser(QBRTCSession qbrtcSession, Integer integer, Map<String, String> map) {
qbrtcSession.addVideoTrackCallbacksListener(this);
if(mp!=null&&mp.isPlaying())
{
mp.stop();
}
StartTimer();
}
@Override
public void onReceiveHangUpFromUser(QBRTCSession qbrtcSession, Integer integer, Map<String, String> map) {
if(mp!=null&&mp.isPlaying())
{
mp.stop();
}
Toast.makeText(this, "Call ended by user", Toast.LENGTH_SHORT).show();
finish();
}
@Override
public void onSessionClosed(QBRTCSession qbrtcSession) {
if(mp!=null&&mp.isPlaying())
{
mp.stop();
}
}
@Override
public void onLocalVideoTrackReceive(QBRTCSession qbrtcSession, QBRTCVideoTrack qbrtcVideoTrack) {
Log.i("errorCheck", "WW1: " + qbrtcSession);
qbrtcVideoTrack.addRenderer(new VideoRenderer(surfaceView));
surfaceView.setMirror(true);
surfaceView.requestLayout();
}
@Override
public void onRemoteVideoTrackReceive(QBRTCSession qbrtcSession, QBRTCVideoTrack qbrtcVideoTrack, Integer integer) {
Log.i("errorCheck", "WW2: " + qbrtcSession);
qbrtcVideoTrack.addRenderer(new VideoRenderer(remoteview));
mediaStreamManager = qbrtcSession.getMediaStreamManager();
remoteview.requestLayout();
}
public void StartDialRinging(){
try {
mp = MediaPlayer.create(getApplicationContext(), R.raw.beep);
mp.setLooping(true);
mp.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
VideoCallServiceに動作しません
public class VideoCallService extends Service implements QBRTCClientSessionCallbacks {
private Timer mTimer = null;
private Handler mHandler = new Handler();
public static final int notify = 300000;
public VideoCallService() {
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
try {
Log.wtf("service", "start");
if (mTimer != null) {
Log.wtf("service", "All ready started");
} else {
mTimer = new Timer(); //recreate new
mTimer.scheduleAtFixedRate(new TimeDisplay(), 0, notify);
LoginChatService();
ProcessCalls();
InitSignalling();
QBRTCClient.getInstance(this).addSessionCallbacksListener(this);
}
}catch (Exception e){
Log.wtf("ex",""+e);
}
return START_NOT_STICKY;
}
private void InitSignalling() {
QBChatService.getInstance().getVideoChatWebRTCSignalingManager()
.addSignalingManagerListener(new QBVideoChatSignalingManagerListener() {
@Override
public void signalingCreated(QBSignaling qbSignaling, boolean createdLocally) {
if (!createdLocally) {
QBRTCClient.getInstance(VideoCallService.this).addSignaling((QBWebRTCSignaling) qbSignaling);
}
}
});
}
private void ProcessCalls() {
QBRTCClient.getInstance(this).prepareToProcessCalls();
}
@Override
public void onReceiveNewSession(QBRTCSession qbrtcSession) {
//DataHolder.getInstance().setServiceData(qbrtcSession,qbrtcSession.getUserInfo());
startActivity(new Intent(this,VideoActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).putExtra("service",true));
}
}
スタートコールの後
マニフェスト
<service
android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service
android:name=".MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<service android:name=".VideoCallService" />
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.quickblox.sample.groupchatwebrtc" />
</intent-filter>
</receiver>
<service
android:name=".GcmPushListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name="com.quickblox.messages.services.gcm.QBGcmPushInstanceIDService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
<meta-data android:name="com.quickblox.messages.TYPE" android:value="GCM" />
<meta-data android:name="com.quickblox.messages.SENDER_ID" android:value="1" />
<meta-data android:name="com.quickblox.messages.QB_ENVIRONMENT" android:value="DEVELOPMENT" />
、セッションが相手
ユーザーの発信者
I/org.webrtc.Logging: SurfaceViewRenderer: localView: onMeasure(). New size: 200x200
I/org.webrtc.Logging: EglRenderer: localView: setLayoutAspectRatio: 1.0
I/org.webrtc.Logging: EglRenderer: opponentView: setLayoutAspectRatio: 0.58536583
D/QBASDK: register network listener
D/QBASDK: Connected. Login to chat, currentUser JID: 39753009-65649, resource: android_ffffffff-ac04-0c2d-ffff-ffffd173e4c0
I/errorCheck: R0: null
I/errorCheck: R1: Bundle[{}]
D/RTCClient.: Added session CALLBACK [email protected]
I/errorCheck: chatService1: [email protected]
D/RTCClient.: Call createNewSessionWithOpponents[39753771]conference type=QBConferenceType{value='1'}
D/RTCClient.QBRTCSession: Create new session
I/errorCheck: Q1: [email protected]
I/errorCheck: Q2: true
D/RTCClient.: New signalling was added for participant39753771
D/RTCClient.QBRTCSession: Make new channel for oppoennt:[email protected]
D/RTCClient.QBRTCSession: isInitiator=true
D/RTCClient.QBRTCSession: ADD VideoTrackCallbacksListener [email protected]
D/RTCClient.QBRTCSession: startCall
D/RTCClient.PeerFactoryManager: Creating Peer connection factory
D/RTCClient.QBRTCSession.SessionWaitingTimers: Stop WaitTimer
しかし、対戦相手がログ(ない着信通知または設定されていないためにのために、この私のログのために作成。 ..)
どうすればこの問題を解決できますか?