-
-
Save cardoso/68d386ca57e720caf3806c4d49b6fc68 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import VoxeetSDK | |
import ReplayKit | |
extension WatchViewController { | |
func setupStream() { | |
let info = VTParticipantInfo(externalID: userId, name: userId, avatarURL: nil) | |
voxeet.conference.delegate = self | |
voxeet.session.open(info: info) { error in | |
self.joinOrCreateConference() | |
} | |
} | |
func joinOrCreateConference() { | |
let options = VTConferenceOptions() | |
options.alias = channelName | |
voxeet.conference.create(options: options, success: { conf in | |
if conf.isNew { | |
self.shareScreen(conf: conf) | |
} else { | |
self.watch(conf: conf) | |
} | |
}, fail: { error in | |
// TODO: Handle errors | |
}) | |
} | |
func shareScreen(conf: VTConference) { | |
self.voxeet.conference.join(conference: conf, success: { conf in | |
DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { | |
self.voxeet.conference.startScreenShare(broadcast: true) { error in | |
// TODO: Handle errors | |
} | |
} | |
}, fail: { error in | |
// TODO: Handle errors | |
}) | |
} | |
func watch(conf: VTConference) { | |
self.voxeet.conference.listen(conference: conf, success: { conf in | |
}, fail: { error in | |
// TODO: Handle errors | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment