当前位置: 首页>>代码示例>>Java>>正文


Java RoomState类代码示例

本文整理汇总了Java中com.twilio.video.RoomState的典型用法代码示例。如果您正苦于以下问题:Java RoomState类的具体用法?Java RoomState怎么用?Java RoomState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RoomState类属于com.twilio.video包,在下文中一共展示了RoomState类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDestroy

import com.twilio.video.RoomState; //导入依赖的package包/类
@Override
protected void onDestroy() {
    /*
     * Always disconnect from the room before leaving the Activity to
     * ensure any memory allocated to the Room resource is freed.
     */
    if (room != null && room.getState() != RoomState.DISCONNECTED) {
        room.disconnect();
        disconnectedFromOnDestroy = true;
    }

    /*
     * Release the local audio and video tracks ensuring any memory allocated to audio
     * or video is freed.
     */
    if (localAudioTrack != null) {
        localAudioTrack.release();
        localAudioTrack = null;
    }
    if (localVideoTrack != null) {
        localVideoTrack.release();
        localVideoTrack = null;
    }

    super.onDestroy();
}
 
开发者ID:twilio,项目名称:video-quickstart-android,代码行数:27,代码来源:VideoActivity.java

示例2: onBackPressed

import com.twilio.video.RoomState; //导入依赖的package包/类
@Override
public void onBackPressed() {

    //Connected....ROOM
    if (room != null && room.getState().equals(RoomState.CONNECTED)) {
        alertDialog = Dialog.createCloseSessionDialog(new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Log.i(TAG, "onBackPressed cancel do nothing.. ");
            }
        }, closeSessionListener(), this);
        alertDialog.show();

    } else if (room != null && !room.getState().equals(RoomState.CONNECTED)) {
        //DO nothing....
    } else {
        super.onBackPressed();
    }

}
 
开发者ID:AppLozic,项目名称:Applozic-Android-Chat-Sample,代码行数:21,代码来源:AudioCallActivityV2.java

示例3: onHostDestroy

import com.twilio.video.RoomState; //导入依赖的package包/类
@Override
public void onHostDestroy() {
    /*
     * Always disconnect from the room before leaving the Activity to
     * ensure any memory allocated to the Room resource is freed.
     */
    if (room != null && room.getState() != RoomState.DISCONNECTED) {
        room.disconnect();
        disconnectedFromOnDestroy = true;
    }

    /*
     * Release the local media ensuring any memory allocated to audio or video is freed.
     */
    if (localVideoTrack != null) {
        localVideoTrack.release();
        localVideoTrack = null;
    }

    if (localAudioTrack != null) {
        localAudioTrack.release();
        localAudioTrack = null;
    }
}
 
开发者ID:blackuy,项目名称:react-native-twilio-video-webrtc,代码行数:25,代码来源:CustomTwilioVideoView.java

示例4: onDestroy

import com.twilio.video.RoomState; //导入依赖的package包/类
@Override
protected void onDestroy() {

       /*
     * Always disconnect from the room before leaving the Activity to
     * ensure any memory allocated to the Room resource is freed.
     */
    if (room != null && room.getState() != RoomState.DISCONNECTED) {
        room.disconnect();
        disconnectedFromOnDestroy = true;
    }

    /*
     * Release the local audio and video tracks ensuring any memory allocated to audio
     * or video is freed.
     */
    if (localAudioTrack != null) {
        localAudioTrack.release();
        localAudioTrack = null;
    }
    if (localVideoTrack != null) {
        localVideoTrack.release();
        localVideoTrack = null;
    }
    if (mediaPlayer != null) {
        mediaPlayer.stop();
        mediaPlayer.release();
    }
    LocalBroadcastManager.getInstance(this).unregisterReceiver(applozicBroadCastReceiver);
    super.onDestroy();
    setOpenStatus(false);

}
 
开发者ID:AppLozic,项目名称:Applozic-Android-Chat-Sample,代码行数:34,代码来源:AudioCallActivityV2.java

示例5: registerForNotificationBroadcast

import com.twilio.video.RoomState; //导入依赖的package包/类
public void registerForNotificationBroadcast() {

        applozicBroadCastReceiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {

                String incomingCallId = intent.getStringExtra(VideoCallNotificationHelper.CALL_ID);
                boolean isNotificationForSameId = false;

                Log.i(TAG, "incomingCallId: " + incomingCallId + ", intent.getAction(): " + intent.getAction());

                if (CONNECTIVITY_CHANGE.equals(intent.getAction())) {
                    if (!Utils.isInternetAvailable(context)) {
                        Toast.makeText(context, R.string.no_network_connectivity, Toast.LENGTH_LONG);
                        if (room != null && room.getState().equals(RoomState.CONNECTED)) {
                            room.disconnect();
                        }
                    }
                    return;
                }

                if (!TextUtils.isEmpty(callId)) {
                    isNotificationForSameId = (callId.equals(incomingCallId));
                }
//                //
//                if (MobiComKitConstants.APPLOZIC_VIDEO_CALL_ANSWER.equals(intent.getAction()) && isNotificationForSameId) {
//                    answered = true;
//                    sendInvite();
//                } else
                if ((MobiComKitConstants.APPLOZIC_VIDEO_CALL_REJECTED.equals(intent.getAction()) ||
                        VideoCallNotificationHelper.CALL_CANCELED.equals(intent.getAction()) ||
                        VideoCallNotificationHelper.CALL_MISSED.equals(intent.getAction()) ||
                        VideoCallNotificationHelper.CALL_END.equals(intent.getAction()))
                        && isNotificationForSameId) {

                    Toast.makeText(context, R.string.participant_busy, Toast.LENGTH_LONG).show();
                    hideProgress();
                    if (room != null) {
                        inviteSent = false;
                        room.disconnect();
                    }
                } else if (MobiComKitConstants.APPLOZIC_VIDEO_DIALED.equals(intent.getAction())) {

                    String contactId = intent.getStringExtra("CONTACT_ID");

                    if (!contactId.equals(contactToCall.getUserId()) || (room != null && room.getState().equals(RoomState.CONNECTED))) {
                        Contact contact = contactService.getContactById(contactId);
                        videoCallNotificationHelper.sendVideoCallReject(contact, incomingCallId);
                        return;
                    }
                    callId = incomingCallId;
                    connectToRoom(callId);
                }
            }
        };
    }
 
开发者ID:AppLozic,项目名称:Applozic-Android-Chat-Sample,代码行数:57,代码来源:AudioCallActivityV2.java


注:本文中的com.twilio.video.RoomState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。