opentok / accelerator-core-js

Accelerator Core provides a simple way to integrate real-time audio/video into your web application using the OpenTok Platform
https://www.vonage.com/communications-apis/video/
MIT License
25 stars 38 forks source link

Adding a name for a published stream(communication.callProperties.name) - updating globally #89

Open parsetty opened 4 years ago

parsetty commented 4 years ago

Adding a name for a published stream and using the communication.callProperties.name while init app, it is updating to all publishers stream. Please find the screenshot below, please help on this.

image image

Thanks Parsetty

parsetty commented 4 years ago

Hi All, Added below code in

opentok-acc-core.js file line number 9446

if(typeof stream.name !== "undefined"){
callProperties.name=stream.name; }

Aemiola commented 3 years ago

Is there a resolution due for this issue ? We have run into it on our project and would love to know if a fix is pending.

saalimkhan18 commented 3 years ago

Is there any update on this bug?

saalimkhan18 commented 3 years ago

added the following code in this.subscribe function of the opentok-acc-core.js

if(typeof stream.name !== "undefined"){ callProperties.name=stream.name; }

UPDATED CODE WILL LOOK LIKE THIS

this.subscribe = function (stream) {
    var subscriberProperties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    var networkTest = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
    var analytics = _this.analytics,
        state = _this.state,
        streamContainers = _this.streamContainers,
        session = _this.session,
        triggerEvent = _this.triggerEvent,
        callProperties = _this.callProperties,
        screenProperties = _this.screenProperties;

    return new Promise(function (resolve, reject) {
      if(typeof stream.name !== "undefined"){
        callProperties.name=stream.name;
        }
      var connectionData = void 0;
      analytics.log(logAction.subscribe, logVariation.attempt);
      var streamMap = state.getStreamMap();
      var streamId = stream.streamId;
      // No videoType indicates SIP https://tokbox.com/developer/guides/sip/

      var type = pathOr('sip', 'videoType', stream);
      if (streamMap[streamId] && !networkTest) {
        // Are we already subscribing to the stream?
        var _state$all = state.all(),
            subscribers = _state$all.subscribers;

        resolve(subscribers[type][streamMap[streamId]]);
      } else {
        try {
          connectionData = JSON.parse(path(['connection', 'data'], stream) || null);
        } catch (e) {
          connectionData = path(['connection', 'data'], stream);
        }
        var container = dom.element(streamContainers('subscriber', type, connectionData, stream));
        var options = Object.assign({}, type === 'camera' || type === 'sip' ? callProperties : screenProperties, subscriberProperties);
        var subscriber = session.subscribe(stream, container, options, function (error) {
          if (error) {
            analytics.log(logAction.subscribe, logVariation.fail);
            reject(error);
          } else {
            state.addSubscriber(subscriber);
            triggerEvent('subscribeTo' + properCase(type), Object.assign({}, { subscriber: subscriber }, state.all()));
            type === 'screen' && triggerEvent('startViewingSharedScreen', subscriber); // Legacy event
            analytics.log(logAction.subscribe, logVariation.success);
            resolve(subscriber);
          }
        });
      }
    });
  };
VRadl commented 1 year ago

What's the status on this issue? It doesn't look like the suggested solution has been merged in.

Thank you