Emit this socket event when the media session's state has changed. Eg.: the user has muted their microphone or disabled video.

Payload Parameters

NameDescriptionJSON type
categoryThe type of media session event.string
contentCurrent state of media session:
  • mediaSession: (object) Current media session state
    • audio: (boolean) Is the user sending audio enabled
    • connected: (boolean) Is the media session connected
    • isCollabOnly: (boolean) corresponds to whether the user is allowed to collaborate in the space or not
    • joinTime: (string) Exact date when the user has joined the space
    • selfMuted: (boolean) Is the user muted locally
    • video: (boolean) Is the user sending video enabled
  • streamId: (string, optional) Unique identifier of the local media feed
  • subscribeTime: (string) Date value describing when the user has joined the space
Object
commentOptional text description of socket event.string
createdTimestamp of when message item was created.string
dataarray
senderInformation about the sender
  • _id: (string) User's id
  • displayname: (string) sender's name which is seen by the other space participants
  • phone_numbers: (array of objects)
    • verified: (boolean) defines whether the phone number is verified
    • primary: (boolean) defines whether the phone number is primary
    • canonicalForm: (string) phone number's standard form
    • type: (string) default is 'mobile'
    • value:(string) phone number value
  • picture_url: (string) a URL to user's profile image
  • type: (string) type of sender ('user' or 'anonymous')
  • username: (string) Sender's login name
Object
topicIdUnique identifier of the space the media session is part of.string

Media Session Event Categories

NameDescription
tracksstatusChange in state of media session (eg.: user muted/unmuted, started screensharing). The first time tracksstatus is sent/received is treated as starting the call.
video.endEnd audio/video call
video.stopscreenshareScreen shared ended

Authorization

Subscribed to channel.

Example

socketConnection.emit('SEND_MEDIA_SESSION_EVENTS', payload);

Payload ('tracksstatus')

{
    "category": "tracksstatus",
    "content": {
        "mediaSession": {
            "audio": true,
            "connected": true,
            "isCollabOnly": false,
            "joinTime": "2020-08-04T06:56:22.660Z",
            "selfMuted": false,
            "video": true
        },
        "streamId": "f50oyeFS29u2tDL1ntF2UgdgOpU4jNDCeEOk",
        "subscribeTime": "2020-08-04T06:55:37.461Z"
    },
    "created": "2020-08-04T06:56:22.659Z",
    "data": [
    ],
    "sender": {
        "_id": "5f04251caa4a347af9946e05",
        "displayname": "Test User",
        "phone_numbers": [
        ],
        "picture_url": "https://storage.googleapis.com/onesna/pictures/pfpic_ltest_34cb97bd-0151-449d-84b0-48e07853b49g",
        "type": "user",
        "username": "test@user.com"
    },
    "topicId": "5f06c25e574ca36b54cb4cdg"
}

Payload ('video.end')

{
   "topicId":"5f06c25e574ca36b54cb4cdg",
   "category":"video.end",
   "comment":"toggle Video Session",
   "sender":{
      "_id":"5f04251caa4a347af9946e05",
      "type":"user",
      "username":"test@user.com",
      "displayname":"Test User",
      "picture_url":"https://storage.googleapis.com/onesna/pictures/pfpic_ltest_34cb97bd-0151-449d-84b0-48e07853b49g",
      "phone_numbers":[

      ]
   },
   "data":[

   ],
   "created":"2020-08-04T06:56:50.023Z",
   "content":{
      "subscribeTime":"2020-08-04T06:55:37.461Z",
      "mediaSession":{

      }
   }
}

Payload ('video.stopscreenshare')

{
   "topicId":"5f06c25e574ca36b54db4cdf",
   "category":"video.stopscreenshare",
   "content":{
      "mediaSession":{
         "audio":true,
         "video":true,
         "connected":true,
         "screenshare":false,
         "isCollabOnly":false,
         "joinTime":"2020-08-04T06:59:47.262Z"
      },
      "subscribeTime":"2020-08-04T06:58:06.254Z"
   },
   "sender":{
      "_id":"5f04251caa4a347af9946e01",
      "type":"user",
      "username":"test@user.com",
      "displayname":"Test User",
      "picture_url":"https://storage.googleapis.com/onesna/pictures/pfpic_ltest_34cb97bd-0151-449d-84b0-48e07853b49f",
      "phone_numbers":[

      ]
   },
   "data":[

   ],
   "created":"2020-08-04T07:00:11.071Z"
}