Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am getting a blank page on Android while waiting for the host #373

Open
hemalatha1217 opened this issue Dec 17, 2024 · 0 comments
Open

Comments

@hemalatha1217
Copy link

I'm using default zoom layout to render
class ZoomMeetingActivity : ComponentActivity() {

private var meetingServiceListener: MeetingServiceListener? = null
private var listener: ZoomSDKInitializeListener? = null

companion object {
    private const val MEETING_NUMBER = "meeting_number"
    private const val MEETING_PASSWORD = "meeting_password"
    private const val TOKEN = "TOKEN"
    private const val WEBINAR_TOKEN = "WEBINAR_TOKEN"
    private const val TYPE = "type"
    // Function to create a new intent for ZoomMeetingActivity
    fun newIntent(
        context: Context,
        token: String,
        meetingNumber: String,
        password: String,
        webinarToken: String,
        type: String
    ): Intent {
        val intent = Intent(context, ZoomMeetingActivity::class.java)
        intent.putExtra(TOKEN, token)
        intent.putExtra(MEETING_NUMBER, meetingNumber)
        intent.putExtra(MEETING_PASSWORD, password)
        intent.putExtra(WEBINAR_TOKEN, webinarToken)
        intent.putExtra(TYPE, type)
        return intent
    }
}

override fun onDestroy() {
    super.onDestroy()
    val sdk = ZoomSDK.getInstance()
    sdk.meetingService.removeListener(meetingServiceListener)
    listener = null
}

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    val meetingNumber = intent?.getStringExtra(MEETING_NUMBER)
    val pwd = intent?.getStringExtra(MEETING_PASSWORD)
    val token = intent?.getStringExtra(TOKEN)
    val webToken = intent?.getStringExtra(WEBINAR_TOKEN)
    val meetType = intent?.getStringExtra(TYPE)
    val context = this.findActivity()?.applicationContext
    val sdk: ZoomSDK = ZoomSDK.getInstance()

    val preferencesManager = PreferencesManager(context!!)

    val firstName = preferencesManager.getData("INFINIPATH_FIRST_NAME", "")
    // Function to start a meeting
    fun startMeeting(context: Context) {
        val meetingService = sdk.meetingService
        val options = StartMeetingOptions().apply {
            no_video = false
        }
        val params = StartMeetingParamsWithoutLogin().apply {
            displayName = firstName.trim()
            meetingNo = meetingNumber
            zoomAccessToken = webToken
        }

        val result = meetingService.startMeetingWithParams(context, params, options)
        if (result == MeetingError.MEETING_ERROR_SUCCESS) {
            return
        } else {
        }

        if (meetingService.meetingStatus == MeetingStatus.MEETING_STATUS_IDLE) {
        } else {
            meetingService.returnToMeeting(context)
        }
    }
    // Function to join a meeting
    fun joinMeeting(context: Context) {
        val meetingService = sdk.meetingService
        val options = JoinMeetingOptions()

// .apply {
// no_driving_mode = false
// no_invite = false
// no_meeting_end_message = false
// no_titlebar = false
// no_bottom_toolbar = false
// no_dial_in_via_phone = true
// no_dial_out_to_phone = true
// no_disconnect_audio = false
// no_share = false
// invite_options = InviteOptions.INVITE_VIA_EMAIL or InviteOptions.INVITE_VIA_SMS
// no_audio = false
// no_video = false
// meeting_views_options = MeetingViewsOptions.NO_TEXT_MEETING_ID or MeetingViewsOptions.NO_TEXT_PASSWORD
// }

        val params = JoinMeetingParams().apply {
            displayName = firstName
            meetingNo = meetingNumber
            password = pwd
            webinarToken = webToken
        }
        val result = meetingService.joinMeetingWithParams(context, params, options)

        Timber.i("meetingService.meetingStatus", result.toString())
        if (result == MeetingError.MEETING_ERROR_SUCCESS) {
            return
        } else {
        }
        Timber.i("meetingService.meetingStatus", meetingService.meetingStatus.toString())
        if (meetingService.meetingStatus == MeetingStatus.MEETING_STATUS_IDLE || meetingService.meetingStatus != MeetingStatus.MEETING_STATUS_WAITINGFORHOST) {
        } else if(meetingService.meetingStatus == MeetingStatus.MEETING_STATUS_WAITINGFORHOST){
        } else {
            meetingService.returnToMeeting(context)
        }
    }
    // Function to redirect to the dashboard
    fun redirectToDashboard() {
        context.findActivity()
            ?.finish()
        val intent = Intent(context, DashboardActivity::class.java)
        context.startActivity(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
    }
    // Meeting service listener to handle meeting status changes
    meetingServiceListener = object : MeetingServiceListener {
        override fun onMeetingStatusChanged(p0: MeetingStatus?, p1: Int, p2: Int) {
            when (p0) {
                MeetingStatus.MEETING_STATUS_WAITINGFORHOST -> {
                    // Let Zoom SDK display its default waiting room
                    Timber.i("ZoomSDK", "Waiting for Host... Default UI will be shown")
                }
                MeetingStatus.MEETING_STATUS_INMEETING -> {
                    Timber.i("ZoomSDK", "Meeting started")
                }
                MeetingStatus.MEETING_STATUS_DISCONNECTING -> {
                    redirectToDashboard()
                }
                else -> Timber.i("ZoomSDK", "Other status: p0")
            }
        }

        override fun onMeetingParameterNotification(p0: MeetingParameter?) {
            // Handle meeting parameter notification
        }
    }

    listener = object : ZoomSDKInitializeListener {
        override fun onZoomSDKInitializeResult(p0: Int, p1: Int) {
            if (p0 == 1) {
                return
            }
            sdk.meetingService.addListener(meetingServiceListener)
            val settingsHelper: MeetingSettingsHelper = sdk.getMeetingSettingsHelper()
            settingsHelper.isCustomizedMeetingUIEnabled = false
            if(sdk.isInitialized) {
                if (meetType.equals("start")) {
                    startMeeting(context)
                } else {
                    joinMeeting(context)
                }

            }
        }

        override fun onZoomAuthIdentityExpired() {
        }
    }

    fun initializeZoomSdk() {
        val initParams = ZoomSDKInitParams().apply {
            jwtToken = token
            domain = "zoom.us"
            enableLog = true
        }
        sdk.initialize(context, listener, initParams)
    }

    initializeZoomSdk()
}

}

But here everything is workig fine except when user is waiting for the host to start the meeting . For that screen it is loading the blank screen. Can you fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant