twilio-video
Advanced tools
Comparing version 1.12.0 to 1.13.0
{ | ||
"name": "twilio-video", | ||
"version": "1.12.0", | ||
"version": "1.13.0", | ||
"description": "Twilio Video JavaScript library", | ||
@@ -5,0 +5,0 @@ "license": "BSD", |
@@ -0,1 +1,31 @@ | ||
1.13.0 (July 30, 2018) | ||
==================== | ||
New Features | ||
------------ | ||
- When the Room is completed via the REST API, the Room emits a "disconnected" | ||
event with a TwilioError 53188, "Room completed". Previously, there was no way | ||
to distinguish this case from calling `disconnect` on the Room (JSDK-1884). In | ||
some applications, this will be expected, so you should set an event listener | ||
on the Room as follows: | ||
```js | ||
room.once('disconnected', (room, error) => { | ||
if (!error) { | ||
console.log('You disconnected from the Room by calling `disconnect`'); | ||
return; | ||
} | ||
switch (error.code) { | ||
case 53118: | ||
console.log('The Room was completed server-side'); | ||
break; | ||
// Handle any other errors of interest. | ||
default: | ||
console.error(`You were disconnected: ${error.message}`); | ||
break; | ||
} | ||
}); | ||
``` | ||
1.12.0 (July 25, 2018) | ||
@@ -2,0 +32,0 @@ ====================== |
@@ -38,5 +38,14 @@ 'use strict'; | ||
value: dataChannel | ||
}, | ||
_messageQueue: { | ||
value: [] | ||
} | ||
}); | ||
dataChannel.addEventListener('open', function () { | ||
_this._messageQueue.splice(0).forEach(function (message) { | ||
return _this._publish(message); | ||
}); | ||
}); | ||
dataChannel.addEventListener('message', function (_ref) { | ||
@@ -56,6 +65,4 @@ var data = _ref.data; | ||
/** | ||
* Publish a message. Returns true if calling the method resulted in | ||
* publishing (or eventually publishing) the update. | ||
* @param {object} message | ||
* @returns {boolean} | ||
* @param message | ||
* @private | ||
*/ | ||
@@ -65,10 +72,27 @@ | ||
_createClass(DataTransport, [{ | ||
key: '_publish', | ||
value: function _publish(message) { | ||
var data = JSON.stringify(message); | ||
this._dataChannel.send(data); | ||
} | ||
/** | ||
* Publish a message. Returns true if calling the method resulted in | ||
* publishing (or eventually publishing) the update. | ||
* @param {object} message | ||
* @returns {boolean} | ||
*/ | ||
}, { | ||
key: 'publish', | ||
value: function publish(message) { | ||
try { | ||
var data = JSON.stringify(message); | ||
this._dataChannel.send(data); | ||
} catch (error) { | ||
var dataChannel = this._dataChannel; | ||
if (dataChannel.readyState === 'closing' || dataChannel.readyState === 'closed') { | ||
return false; | ||
} | ||
if (dataChannel.readyState === 'connecting') { | ||
this._messageQueue.push(message); | ||
return true; | ||
} | ||
this._publish(message); | ||
return true; | ||
@@ -75,0 +99,0 @@ } |
@@ -60,3 +60,2 @@ 'use strict'; | ||
environment: options.environment, | ||
negotiateDominantSpeaker: options._enableDominantSpeaker, | ||
negotiateNetworkQuality: options._enableNetworkQualityLevel, | ||
@@ -63,0 +62,0 @@ iceServerSourceStatus: iceServerSource.status, |
@@ -21,8 +21,11 @@ 'use strict'; | ||
var _require = require('../../util/twilio-video-errors'), | ||
SignalingConnectionDisconnectedError = _require.SignalingConnectionDisconnectedError, | ||
SignalingConnectionError = _require.SignalingConnectionError, | ||
SignalingConnectionTimeoutError = _require.SignalingConnectionTimeoutError, | ||
SignalingIncomingMessageInvalidError = _require.SignalingIncomingMessageInvalidError, | ||
createTwilioError = _require.createTwilioError; | ||
RoomCompletedError = _require.RoomCompletedError; | ||
var _require2 = require('../../util/twilio-video-errors'), | ||
SignalingConnectionDisconnectedError = _require2.SignalingConnectionDisconnectedError, | ||
SignalingConnectionError = _require2.SignalingConnectionError, | ||
SignalingConnectionTimeoutError = _require2.SignalingConnectionTimeoutError, | ||
SignalingIncomingMessageInvalidError = _require2.SignalingIncomingMessageInvalidError, | ||
createTwilioError = _require2.createTwilioError; | ||
var SDK_NAME = packageInfo.name + '.js'; | ||
@@ -123,3 +126,3 @@ var SDK_VERSION = packageInfo.version; | ||
_session: { | ||
value: createSession(_this, name, accessToken, localParticipant, peerConnectionManager, ua, options.SIPJSMediaHandler, options.iceServerSourceStatus, options.negotiateNetworkQuality, options.negotiateDominantSpeaker) | ||
value: createSession(_this, name, accessToken, localParticipant, peerConnectionManager, ua, options.SIPJSMediaHandler, options.iceServerSourceStatus, options.negotiateNetworkQuality) | ||
} | ||
@@ -230,3 +233,3 @@ }); | ||
function createSession(transport, name, accessToken, localParticipant, peerConnectionManager, ua, SIPJSMediaHandler, iceServerSourceStatus, negotiateNetworkQuality, negotiateDominantSpeaker) { | ||
function createSession(transport, name, accessToken, localParticipant, peerConnectionManager, ua, SIPJSMediaHandler, iceServerSourceStatus, negotiateNetworkQuality) { | ||
var target = 'sip:' + util.makeServerSIPURI(); | ||
@@ -269,7 +272,6 @@ return ua.invite(target, { | ||
} | ||
if (negotiateDominantSpeaker) { | ||
message.media_signaling.active_speaker = { | ||
transports: [{ type: 'data-channel' }] | ||
}; | ||
} | ||
message.media_signaling.active_speaker = { | ||
transports: [{ type: 'data-channel' }] | ||
}; | ||
} | ||
@@ -423,3 +425,16 @@ | ||
var message = parseRequestOrResponseBody(requestOrResponse); | ||
return message && message.type === 'error' ? createTwilioError(message.code, message.message) : null; | ||
if (message) { | ||
switch (message.type) { | ||
case 'disconnected': | ||
if (message.status === 'completed') { | ||
return new RoomCompletedError(); | ||
} | ||
break; | ||
case 'error': | ||
return createTwilioError(message.code, message.message); | ||
default: | ||
break; | ||
} | ||
} | ||
return null; | ||
} catch (error) { | ||
@@ -462,2 +477,3 @@ return error; | ||
} | ||
if (!twilioError) { | ||
@@ -525,3 +541,3 @@ switch (cause) { | ||
case 'disconnected': | ||
transport.preempt('disconnected'); | ||
transport.disconnect(message.status === 'completed' ? new RoomCompletedError() : null); | ||
return; | ||
@@ -543,3 +559,3 @@ default: | ||
case 'disconnected': | ||
transport.preempt('disconnected'); | ||
transport.disconnect(message.status === 'completed' ? new RoomCompletedError() : null); | ||
return; | ||
@@ -564,3 +580,3 @@ default: | ||
case 'disconnected': | ||
transport.preempt('disconnected'); | ||
transport.disconnect(message.status === 'completed' ? new RoomCompletedError() : null); | ||
return; | ||
@@ -567,0 +583,0 @@ default: |
@@ -627,2 +627,117 @@ 'use strict'; | ||
/** | ||
* @class RoomInvalidParametersError | ||
* @classdesc Raised in the REST API when one or more Room creation parameter is incompatible with the Room type. | ||
* @extends TwilioError | ||
* @property {number} code - 53114 | ||
* @property {string} message - 'Room creation parameter(s) incompatible with the Room type' | ||
*/ | ||
var RoomInvalidParametersError = function (_TwilioError27) { | ||
_inherits(RoomInvalidParametersError, _TwilioError27); | ||
function RoomInvalidParametersError() { | ||
_classCallCheck(this, RoomInvalidParametersError); | ||
return _possibleConstructorReturn(this, (RoomInvalidParametersError.__proto__ || Object.getPrototypeOf(RoomInvalidParametersError)).call(this, 53114, 'Room creation parameter(s) incompatible with the Room type')); | ||
} | ||
return RoomInvalidParametersError; | ||
}(TwilioError); | ||
exports.RoomInvalidParametersError = RoomInvalidParametersError; | ||
Object.defineProperty(TwilioErrorByCode, 53114, { value: RoomInvalidParametersError }); | ||
/** | ||
* @class RoomMediaRegionInvalidError | ||
* @classdesc Raised in the REST API when MediaRegion is set to an invalid value. | ||
* @extends TwilioError | ||
* @property {number} code - 53115 | ||
* @property {string} message - 'MediaRegion is invalid' | ||
*/ | ||
var RoomMediaRegionInvalidError = function (_TwilioError28) { | ||
_inherits(RoomMediaRegionInvalidError, _TwilioError28); | ||
function RoomMediaRegionInvalidError() { | ||
_classCallCheck(this, RoomMediaRegionInvalidError); | ||
return _possibleConstructorReturn(this, (RoomMediaRegionInvalidError.__proto__ || Object.getPrototypeOf(RoomMediaRegionInvalidError)).call(this, 53115, 'MediaRegion is invalid')); | ||
} | ||
return RoomMediaRegionInvalidError; | ||
}(TwilioError); | ||
exports.RoomMediaRegionInvalidError = RoomMediaRegionInvalidError; | ||
Object.defineProperty(TwilioErrorByCode, 53115, { value: RoomMediaRegionInvalidError }); | ||
/** | ||
* @class RoomMediaRegionUnavailableError | ||
* @classdesc Raised in the REST API when MediaRegion is set to a valid value but no media servers are available. | ||
* @extends TwilioError | ||
* @property {number} code - 53116 | ||
* @property {string} message - 'There are no media servers available in the MediaRegion' | ||
*/ | ||
var RoomMediaRegionUnavailableError = function (_TwilioError29) { | ||
_inherits(RoomMediaRegionUnavailableError, _TwilioError29); | ||
function RoomMediaRegionUnavailableError() { | ||
_classCallCheck(this, RoomMediaRegionUnavailableError); | ||
return _possibleConstructorReturn(this, (RoomMediaRegionUnavailableError.__proto__ || Object.getPrototypeOf(RoomMediaRegionUnavailableError)).call(this, 53116, 'There are no media servers available in the MediaRegion')); | ||
} | ||
return RoomMediaRegionUnavailableError; | ||
}(TwilioError); | ||
exports.RoomMediaRegionUnavailableError = RoomMediaRegionUnavailableError; | ||
Object.defineProperty(TwilioErrorByCode, 53116, { value: RoomMediaRegionUnavailableError }); | ||
/** | ||
* @class RoomSubscriptionOperationNotSupportedError | ||
* @classdesc Raised whenever the subscription operation requested is not supported for the Room type. | ||
* @extends TwilioError | ||
* @property {number} code - 53117 | ||
* @property {string} message - 'The subscription operation requested is not supported for the Room type' | ||
*/ | ||
var RoomSubscriptionOperationNotSupportedError = function (_TwilioError30) { | ||
_inherits(RoomSubscriptionOperationNotSupportedError, _TwilioError30); | ||
function RoomSubscriptionOperationNotSupportedError() { | ||
_classCallCheck(this, RoomSubscriptionOperationNotSupportedError); | ||
return _possibleConstructorReturn(this, (RoomSubscriptionOperationNotSupportedError.__proto__ || Object.getPrototypeOf(RoomSubscriptionOperationNotSupportedError)).call(this, 53117, 'The subscription operation requested is not supported for the Room type')); | ||
} | ||
return RoomSubscriptionOperationNotSupportedError; | ||
}(TwilioError); | ||
exports.RoomSubscriptionOperationNotSupportedError = RoomSubscriptionOperationNotSupportedError; | ||
Object.defineProperty(TwilioErrorByCode, 53117, { value: RoomSubscriptionOperationNotSupportedError }); | ||
/** | ||
* @class RoomCompletedError | ||
* @classdesc Raised whenever a Room is completed via the REST API. | ||
* @extends TwilioError | ||
* @property {number} code - 53118 | ||
* @property {string} message - 'Room completed' | ||
*/ | ||
var RoomCompletedError = function (_TwilioError31) { | ||
_inherits(RoomCompletedError, _TwilioError31); | ||
function RoomCompletedError() { | ||
_classCallCheck(this, RoomCompletedError); | ||
return _possibleConstructorReturn(this, (RoomCompletedError.__proto__ || Object.getPrototypeOf(RoomCompletedError)).call(this, 53118, 'Room completed')); | ||
} | ||
return RoomCompletedError; | ||
}(TwilioError); | ||
exports.RoomCompletedError = RoomCompletedError; | ||
Object.defineProperty(TwilioErrorByCode, 53118, { value: RoomCompletedError }); | ||
/** | ||
* @class ParticipantIdentityInvalidError | ||
@@ -635,4 +750,4 @@ * @classdesc Raised whenever a Participant identity is invalid, and the scenario is not covered by a more specific error code. | ||
var ParticipantIdentityInvalidError = function (_TwilioError27) { | ||
_inherits(ParticipantIdentityInvalidError, _TwilioError27); | ||
var ParticipantIdentityInvalidError = function (_TwilioError32) { | ||
_inherits(ParticipantIdentityInvalidError, _TwilioError32); | ||
@@ -659,4 +774,4 @@ function ParticipantIdentityInvalidError() { | ||
var ParticipantIdentityTooLongError = function (_TwilioError28) { | ||
_inherits(ParticipantIdentityTooLongError, _TwilioError28); | ||
var ParticipantIdentityTooLongError = function (_TwilioError33) { | ||
_inherits(ParticipantIdentityTooLongError, _TwilioError33); | ||
@@ -683,4 +798,4 @@ function ParticipantIdentityTooLongError() { | ||
var ParticipantIdentityCharsInvalidError = function (_TwilioError29) { | ||
_inherits(ParticipantIdentityCharsInvalidError, _TwilioError29); | ||
var ParticipantIdentityCharsInvalidError = function (_TwilioError34) { | ||
_inherits(ParticipantIdentityCharsInvalidError, _TwilioError34); | ||
@@ -707,4 +822,4 @@ function ParticipantIdentityCharsInvalidError() { | ||
var ParticipantMaxTracksExceededError = function (_TwilioError30) { | ||
_inherits(ParticipantMaxTracksExceededError, _TwilioError30); | ||
var ParticipantMaxTracksExceededError = function (_TwilioError35) { | ||
_inherits(ParticipantMaxTracksExceededError, _TwilioError35); | ||
@@ -731,4 +846,4 @@ function ParticipantMaxTracksExceededError() { | ||
var ParticipantNotFoundError = function (_TwilioError31) { | ||
_inherits(ParticipantNotFoundError, _TwilioError31); | ||
var ParticipantNotFoundError = function (_TwilioError36) { | ||
_inherits(ParticipantNotFoundError, _TwilioError36); | ||
@@ -755,4 +870,4 @@ function ParticipantNotFoundError() { | ||
var ParticipantDuplicateIdentityError = function (_TwilioError32) { | ||
_inherits(ParticipantDuplicateIdentityError, _TwilioError32); | ||
var ParticipantDuplicateIdentityError = function (_TwilioError37) { | ||
_inherits(ParticipantDuplicateIdentityError, _TwilioError37); | ||
@@ -779,4 +894,4 @@ function ParticipantDuplicateIdentityError() { | ||
var TrackInvalidError = function (_TwilioError33) { | ||
_inherits(TrackInvalidError, _TwilioError33); | ||
var TrackInvalidError = function (_TwilioError38) { | ||
_inherits(TrackInvalidError, _TwilioError38); | ||
@@ -803,4 +918,4 @@ function TrackInvalidError() { | ||
var TrackNameInvalidError = function (_TwilioError34) { | ||
_inherits(TrackNameInvalidError, _TwilioError34); | ||
var TrackNameInvalidError = function (_TwilioError39) { | ||
_inherits(TrackNameInvalidError, _TwilioError39); | ||
@@ -827,4 +942,4 @@ function TrackNameInvalidError() { | ||
var TrackNameTooLongError = function (_TwilioError35) { | ||
_inherits(TrackNameTooLongError, _TwilioError35); | ||
var TrackNameTooLongError = function (_TwilioError40) { | ||
_inherits(TrackNameTooLongError, _TwilioError40); | ||
@@ -851,4 +966,4 @@ function TrackNameTooLongError() { | ||
var TrackNameCharsInvalidError = function (_TwilioError36) { | ||
_inherits(TrackNameCharsInvalidError, _TwilioError36); | ||
var TrackNameCharsInvalidError = function (_TwilioError41) { | ||
_inherits(TrackNameCharsInvalidError, _TwilioError41); | ||
@@ -875,4 +990,4 @@ function TrackNameCharsInvalidError() { | ||
var TrackNameIsDuplicatedError = function (_TwilioError37) { | ||
_inherits(TrackNameIsDuplicatedError, _TwilioError37); | ||
var TrackNameIsDuplicatedError = function (_TwilioError42) { | ||
_inherits(TrackNameIsDuplicatedError, _TwilioError42); | ||
@@ -892,2 +1007,25 @@ function TrackNameIsDuplicatedError() { | ||
/** | ||
* @class TrackServerTrackCapacityReachedError | ||
* @classdesc The server does not have enough resources available to create a new Track. | ||
* @extends TwilioError | ||
* @property {number} code - 53305 | ||
* @property {string} message - 'The server has reached capacity and cannot fulfill this request.' | ||
*/ | ||
var TrackServerTrackCapacityReachedError = function (_TwilioError43) { | ||
_inherits(TrackServerTrackCapacityReachedError, _TwilioError43); | ||
function TrackServerTrackCapacityReachedError() { | ||
_classCallCheck(this, TrackServerTrackCapacityReachedError); | ||
return _possibleConstructorReturn(this, (TrackServerTrackCapacityReachedError.__proto__ || Object.getPrototypeOf(TrackServerTrackCapacityReachedError)).call(this, 53305, 'The server has reached capacity and cannot fulfill this request.')); | ||
} | ||
return TrackServerTrackCapacityReachedError; | ||
}(TwilioError); | ||
exports.TrackServerTrackCapacityReachedError = TrackServerTrackCapacityReachedError; | ||
Object.defineProperty(TwilioErrorByCode, 53305, { value: TrackServerTrackCapacityReachedError }); | ||
/** | ||
* @class MediaClientLocalDescFailedError | ||
@@ -900,4 +1038,4 @@ * @classdesc Raised whenever a Client is unable to create or apply a local media description. | ||
var MediaClientLocalDescFailedError = function (_TwilioError38) { | ||
_inherits(MediaClientLocalDescFailedError, _TwilioError38); | ||
var MediaClientLocalDescFailedError = function (_TwilioError44) { | ||
_inherits(MediaClientLocalDescFailedError, _TwilioError44); | ||
@@ -924,4 +1062,4 @@ function MediaClientLocalDescFailedError() { | ||
var MediaServerLocalDescFailedError = function (_TwilioError39) { | ||
_inherits(MediaServerLocalDescFailedError, _TwilioError39); | ||
var MediaServerLocalDescFailedError = function (_TwilioError45) { | ||
_inherits(MediaServerLocalDescFailedError, _TwilioError45); | ||
@@ -948,4 +1086,4 @@ function MediaServerLocalDescFailedError() { | ||
var MediaClientRemoteDescFailedError = function (_TwilioError40) { | ||
_inherits(MediaClientRemoteDescFailedError, _TwilioError40); | ||
var MediaClientRemoteDescFailedError = function (_TwilioError46) { | ||
_inherits(MediaClientRemoteDescFailedError, _TwilioError46); | ||
@@ -972,4 +1110,4 @@ function MediaClientRemoteDescFailedError() { | ||
var MediaServerRemoteDescFailedError = function (_TwilioError41) { | ||
_inherits(MediaServerRemoteDescFailedError, _TwilioError41); | ||
var MediaServerRemoteDescFailedError = function (_TwilioError47) { | ||
_inherits(MediaServerRemoteDescFailedError, _TwilioError47); | ||
@@ -996,4 +1134,4 @@ function MediaServerRemoteDescFailedError() { | ||
var MediaNoSupportedCodecError = function (_TwilioError42) { | ||
_inherits(MediaNoSupportedCodecError, _TwilioError42); | ||
var MediaNoSupportedCodecError = function (_TwilioError48) { | ||
_inherits(MediaNoSupportedCodecError, _TwilioError48); | ||
@@ -1014,3 +1152,3 @@ function MediaNoSupportedCodecError() { | ||
* @class MediaConnectionError | ||
* @classdesc Raised by the Client whenever a media connection fails. | ||
* @classdesc Raised by the Client or Server whenever a media connection fails. | ||
* @extends TwilioError | ||
@@ -1021,4 +1159,4 @@ * @property {number} code - 53405 | ||
var MediaConnectionError = function (_TwilioError43) { | ||
_inherits(MediaConnectionError, _TwilioError43); | ||
var MediaConnectionError = function (_TwilioError49) { | ||
_inherits(MediaConnectionError, _TwilioError49); | ||
@@ -1045,4 +1183,4 @@ function MediaConnectionError() { | ||
var ConfigurationAcquireFailedError = function (_TwilioError44) { | ||
_inherits(ConfigurationAcquireFailedError, _TwilioError44); | ||
var ConfigurationAcquireFailedError = function (_TwilioError50) { | ||
_inherits(ConfigurationAcquireFailedError, _TwilioError50); | ||
@@ -1069,4 +1207,4 @@ function ConfigurationAcquireFailedError() { | ||
var ConfigurationAcquireTurnFailedError = function (_TwilioError45) { | ||
_inherits(ConfigurationAcquireTurnFailedError, _TwilioError45); | ||
var ConfigurationAcquireTurnFailedError = function (_TwilioError51) { | ||
_inherits(ConfigurationAcquireTurnFailedError, _TwilioError51); | ||
@@ -1073,0 +1211,0 @@ function ConfigurationAcquireTurnFailedError() { |
@@ -23,5 +23,12 @@ 'use strict'; | ||
value: dataChannel | ||
}, | ||
_messageQueue: { | ||
value: [] | ||
} | ||
}); | ||
dataChannel.addEventListener('open', () => { | ||
this._messageQueue.splice(0).forEach(message => this._publish(message)); | ||
}); | ||
dataChannel.addEventListener('message', ({ data }) => { | ||
@@ -38,2 +45,11 @@ try { | ||
/** | ||
* @param message | ||
* @private | ||
*/ | ||
_publish(message) { | ||
const data = JSON.stringify(message); | ||
this._dataChannel.send(data); | ||
} | ||
/** | ||
* Publish a message. Returns true if calling the method resulted in | ||
@@ -45,8 +61,11 @@ * publishing (or eventually publishing) the update. | ||
publish(message) { | ||
try { | ||
const data = JSON.stringify(message); | ||
this._dataChannel.send(data); | ||
} catch (error) { | ||
const dataChannel = this._dataChannel; | ||
if (dataChannel.readyState === 'closing' || dataChannel.readyState === 'closed') { | ||
return false; | ||
} | ||
if (dataChannel.readyState === 'connecting') { | ||
this._messageQueue.push(message); | ||
return true; | ||
} | ||
this._publish(message); | ||
return true; | ||
@@ -53,0 +72,0 @@ } |
@@ -60,3 +60,2 @@ 'use strict'; | ||
environment: options.environment, | ||
negotiateDominantSpeaker: options._enableDominantSpeaker, | ||
negotiateNetworkQuality: options._enableNetworkQualityLevel, | ||
@@ -63,0 +62,0 @@ iceServerSourceStatus: iceServerSource.status, |
@@ -11,2 +11,3 @@ 'use strict'; | ||
const util = require('../../util'); | ||
const { RoomCompletedError } = require('../../util/twilio-video-errors'); | ||
@@ -133,4 +134,3 @@ const { | ||
options.iceServerSourceStatus, | ||
options.negotiateNetworkQuality, | ||
options.negotiateDominantSpeaker) | ||
options.negotiateNetworkQuality) | ||
} | ||
@@ -226,3 +226,3 @@ }); | ||
function createSession(transport, name, accessToken, localParticipant, peerConnectionManager, ua, SIPJSMediaHandler, iceServerSourceStatus, negotiateNetworkQuality, negotiateDominantSpeaker) { | ||
function createSession(transport, name, accessToken, localParticipant, peerConnectionManager, ua, SIPJSMediaHandler, iceServerSourceStatus, negotiateNetworkQuality) { | ||
const target = `sip:${util.makeServerSIPURI()}`; | ||
@@ -270,9 +270,8 @@ return ua.invite(target, { | ||
} | ||
if (negotiateDominantSpeaker) { | ||
message.media_signaling.active_speaker = { | ||
transports: [ | ||
{ type: 'data-channel' } | ||
] | ||
}; | ||
} | ||
message.media_signaling.active_speaker = { | ||
transports: [ | ||
{ type: 'data-channel' } | ||
] | ||
}; | ||
} | ||
@@ -431,5 +430,16 @@ | ||
const message = parseRequestOrResponseBody(requestOrResponse); | ||
return message && message.type === 'error' | ||
? createTwilioError(message.code, message.message) | ||
: null; | ||
if (message) { | ||
switch (message.type) { | ||
case 'disconnected': | ||
if (message.status === 'completed') { | ||
return new RoomCompletedError(); | ||
} | ||
break; | ||
case 'error': | ||
return createTwilioError(message.code, message.message); | ||
default: | ||
break; | ||
} | ||
} | ||
return null; | ||
} catch (error) { | ||
@@ -473,2 +483,3 @@ return error; | ||
} | ||
if (!twilioError) { | ||
@@ -536,3 +547,5 @@ switch (cause) { | ||
case 'disconnected': | ||
transport.preempt('disconnected'); | ||
transport.disconnect(message.status === 'completed' | ||
? new RoomCompletedError() | ||
: null); | ||
return; | ||
@@ -554,3 +567,5 @@ default: | ||
case 'disconnected': | ||
transport.preempt('disconnected'); | ||
transport.disconnect(message.status === 'completed' | ||
? new RoomCompletedError() | ||
: null); | ||
return; | ||
@@ -575,3 +590,5 @@ default: | ||
case 'disconnected': | ||
transport.preempt('disconnected'); | ||
transport.disconnect(message.status === 'completed' | ||
? new RoomCompletedError() | ||
: null); | ||
return; | ||
@@ -578,0 +595,0 @@ default: |
@@ -439,2 +439,82 @@ 'use strict'; | ||
/** | ||
* @class RoomInvalidParametersError | ||
* @classdesc Raised in the REST API when one or more Room creation parameter is incompatible with the Room type. | ||
* @extends TwilioError | ||
* @property {number} code - 53114 | ||
* @property {string} message - 'Room creation parameter(s) incompatible with the Room type' | ||
*/ | ||
class RoomInvalidParametersError extends TwilioError { | ||
constructor() { | ||
super(53114, 'Room creation parameter(s) incompatible with the Room type'); | ||
} | ||
} | ||
exports.RoomInvalidParametersError = RoomInvalidParametersError; | ||
Object.defineProperty(TwilioErrorByCode, 53114, { value: RoomInvalidParametersError }); | ||
/** | ||
* @class RoomMediaRegionInvalidError | ||
* @classdesc Raised in the REST API when MediaRegion is set to an invalid value. | ||
* @extends TwilioError | ||
* @property {number} code - 53115 | ||
* @property {string} message - 'MediaRegion is invalid' | ||
*/ | ||
class RoomMediaRegionInvalidError extends TwilioError { | ||
constructor() { | ||
super(53115, 'MediaRegion is invalid'); | ||
} | ||
} | ||
exports.RoomMediaRegionInvalidError = RoomMediaRegionInvalidError; | ||
Object.defineProperty(TwilioErrorByCode, 53115, { value: RoomMediaRegionInvalidError }); | ||
/** | ||
* @class RoomMediaRegionUnavailableError | ||
* @classdesc Raised in the REST API when MediaRegion is set to a valid value but no media servers are available. | ||
* @extends TwilioError | ||
* @property {number} code - 53116 | ||
* @property {string} message - 'There are no media servers available in the MediaRegion' | ||
*/ | ||
class RoomMediaRegionUnavailableError extends TwilioError { | ||
constructor() { | ||
super(53116, 'There are no media servers available in the MediaRegion'); | ||
} | ||
} | ||
exports.RoomMediaRegionUnavailableError = RoomMediaRegionUnavailableError; | ||
Object.defineProperty(TwilioErrorByCode, 53116, { value: RoomMediaRegionUnavailableError }); | ||
/** | ||
* @class RoomSubscriptionOperationNotSupportedError | ||
* @classdesc Raised whenever the subscription operation requested is not supported for the Room type. | ||
* @extends TwilioError | ||
* @property {number} code - 53117 | ||
* @property {string} message - 'The subscription operation requested is not supported for the Room type' | ||
*/ | ||
class RoomSubscriptionOperationNotSupportedError extends TwilioError { | ||
constructor() { | ||
super(53117, 'The subscription operation requested is not supported for the Room type'); | ||
} | ||
} | ||
exports.RoomSubscriptionOperationNotSupportedError = RoomSubscriptionOperationNotSupportedError; | ||
Object.defineProperty(TwilioErrorByCode, 53117, { value: RoomSubscriptionOperationNotSupportedError }); | ||
/** | ||
* @class RoomCompletedError | ||
* @classdesc Raised whenever a Room is completed via the REST API. | ||
* @extends TwilioError | ||
* @property {number} code - 53118 | ||
* @property {string} message - 'Room completed' | ||
*/ | ||
class RoomCompletedError extends TwilioError { | ||
constructor() { | ||
super(53118, 'Room completed'); | ||
} | ||
} | ||
exports.RoomCompletedError = RoomCompletedError; | ||
Object.defineProperty(TwilioErrorByCode, 53118, { value: RoomCompletedError }); | ||
/** | ||
* @class ParticipantIdentityInvalidError | ||
@@ -616,2 +696,18 @@ * @classdesc Raised whenever a Participant identity is invalid, and the scenario is not covered by a more specific error code. | ||
/** | ||
* @class TrackServerTrackCapacityReachedError | ||
* @classdesc The server does not have enough resources available to create a new Track. | ||
* @extends TwilioError | ||
* @property {number} code - 53305 | ||
* @property {string} message - 'The server has reached capacity and cannot fulfill this request.' | ||
*/ | ||
class TrackServerTrackCapacityReachedError extends TwilioError { | ||
constructor() { | ||
super(53305, 'The server has reached capacity and cannot fulfill this request.'); | ||
} | ||
} | ||
exports.TrackServerTrackCapacityReachedError = TrackServerTrackCapacityReachedError; | ||
Object.defineProperty(TwilioErrorByCode, 53305, { value: TrackServerTrackCapacityReachedError }); | ||
/** | ||
* @class MediaClientLocalDescFailedError | ||
@@ -698,3 +794,3 @@ * @classdesc Raised whenever a Client is unable to create or apply a local media description. | ||
* @class MediaConnectionError | ||
* @classdesc Raised by the Client whenever a media connection fails. | ||
* @classdesc Raised by the Client or Server whenever a media connection fails. | ||
* @extends TwilioError | ||
@@ -701,0 +797,0 @@ * @property {number} code - 53405 |
@@ -5,3 +5,3 @@ { | ||
"description": "Twilio Video JavaScript library", | ||
"version": "1.12.0", | ||
"version": "1.13.0", | ||
"homepage": "https://twilio.com", | ||
@@ -8,0 +8,0 @@ "author": "Mark Andrus Roberts <mroberts@twilio.com>", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3183868
63699