Vadai börtönnel fenyegeti a fideszeseketUnpublishing a publisher and trying to publish right after not working


URL: #https://stackoverflow.com/questions/50319044/unpublishing-a-publisher-and-trying-to-publish-right-after-not-working

Irányítószám alapú tájékoztató rendszer használati útmutatója

Több szintű keresés

A kereső mezőbe beírhat kulcsszót, vagy szótöredéket, amely a kiválasztott nézetben megjelent bejegyzéseket szűkíti
A kulcsszó fülre kattintva tematikusan lehet gyors szűkítést(keresést) kérni
A különböző keresések kombinálhatók

Cikkek megjelenítése

A bejegyzések a letárolt URL-cím (webcím) alapján a rendszer a fejléc alatti ablakban, vagy új ablakban jeleníti meg

Youtube videók megjelenítése

A viedeókat a letárolt URL-cím (webcím) alapján a rendszer a fejléc alatti ablakban, vagy új ablakban jeleníti meg

Facebook bejegyzések olvasásá

A bejegyzéseket a letárolt URL-cím (webcím) alapján a rendszer mindíg új ablakban jeleníti meg

Regisztráció, belépés

A rendszer összes szolgáltatásának elérése a regisztráció után lehetséges.
A regisztrációhoz NEM KÉRÜNK személyes adatot Öntől!!!
A rendszer generál egy véletlen azonosítót, amely elegendő a használathoz
Ha megadja postai irányítószámát, akkor a helyi híreket, tartalmakat gyorsan elérheti

Üzenet küldés, olvasás

Regisztrált felhasználóként üzenetet küldhet és olvashat a helyi csoportnak

Forgalmi adatok lekérdezése

Regisztrált felhasználóként a saját aktivitási adatait lekérdezheti, amelyek alapján különböző helyi kedvezményeket vehet igénybe

I am using the tokbox javascript sdk in the browser. I am having trouble recreating a publisher. My situation is like this:

I create a publisher which broadcasts audio and video
At a certain point, I want to switch the audio source, to a different MediaStream source.
I unpublish the previous publisher on the session and destroy it in the callback
I try to create a new publisher with this new configuration.
Wheneven I do this I end up with the following error:

Session.publish, could not publish in a reasonable amount of time.

I've searched on SO and online for some answers. I have ran into people with similar problems like this or this but neither have answers to this issue.

Basically, I either need to find out how I can alter an existing publisher that is already broadcasting (in terms of audio and video source config), or I am doing something wrong with the lifecycle of the publisher when I am trying to create a new one.

Creating a second publisher while having the first seems to work okay, but first destroying one and then trying to create a new one seems to yield the issue described.

Here is the sample code:

// returns existing publisher
const existing = selectPublisher(getState());

if (existing) {
session.unpublish(existing);
existing.destroy();
console.log('destroyed.');
}

const publisher = OT.initPublisher(
'publisher-container',
finalOptions,
error => {
console.log(error);
}
);

session.publish(publisher, error => {
console.log(error);
});
Initialisation of the publisher seems to work, it prints undefined. The print ends up with:

index.js:2177 OT.Publisher.onPublishingTimeout
index.js:2177 OT.exception :: title: Unable to Publish (1500) msg: ICEWorkflow
index.js:2177 1500 "Session.publish :: Could not publish in a reasonable amount of time"
I am using the opentok npm client package version 2.14.2

EDIT:

It seems that the problem is caused by the options I was passing into the publisher, the example above works fine if I just use the default options (not pass in any into the publisher).

I am using two MediaStreamTrack objects, one for audio and video, gathered using OT.getUserMedia(options). It looks like the first time it is working fine, but as soon as I unpublish and republish with the same two MediaStreamTrack objects I run into this issue.

The object I'm passing it look like this (from chrome console):

audioSource: MediaStreamTrack {kind: "audio", id: "9414787b-82b9-48c3-99bd-3208b46c2f9f", label: "Built-in Microphone", enabled: true, muted: false, …}

videoSource: MediaStreamTrack {kind: "video", id: "3f20c926-7d0c-4537-8e8d-ef4b22393a58", label: "FaceTime HD Camera", enabled: true, muted: false, …}