After stream.stop () the published stream in Web SDK,
Immediately after, you need to publish with another stream name in the same session.
In this case, the video published later may not be displayed on iOS Safari only.
However, if you setTimeout () for about 1 second between stop () and publish (), the video is almost certainly displayed.
I'd like to synchronize with the stop () function to make publish () later, is that possible?
Is there any other way if I can't do that?
The following is a sample.
Immediately after, you need to publish with another stream name in the same session.
In this case, the video published later may not be displayed on iOS Safari only.
However, if you setTimeout () for about 1 second between stop () and publish (), the video is almost certainly displayed.
I'd like to synchronize with the stop () function to make publish () later, is that possible?
Is there any other way if I can't do that?
The following is a sample.
Code:
// …
// …One stream has already been successfully published
stream.stop() // Publish Stream stop
// If setTImeout () is executed here, the stream to be published is displayed...
if (MediaServerManager.getSessions().length > 0) {
// eslint-disable-next-line no-undef
const session = MediaServerManager.getSessions()[0]
if (Browser.isSafariWebRTC()) {
playFirstVideo(localVideoDiv, true)
}
session.createStream({
name: streamName,
display: LocalVideoDiv,
…
}).on(STREAM_STATUS.PUBLISHING, (publishStream) => {
}).on(STREAM_STATUS.FAILED, () => {
}).on(STREAM_STATUS.UNPUBLISHED, () => {
}).publish() // the video published later may not be displayed
}
Last edited: