@pipecat-ai/gemini-live-websocket-transport 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +208 -33
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +209 -34
- package/dist/index.module.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";
|
|
1
|
+
{"mappings":";ASUA,QAAO,QAAQ;IACb,UAAkB,kBAAkB,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAClE,UAAkB,QAAQ,EAAE,oBAAoB,CAAC;IACjD,SAAS,CAAC,UAAU,EAAE,kBAAkB,CAAM;IAE9C,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC;IAC/B,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC;;IAO/B,oBAAoB,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI;IAGnE,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,QAAQ,GAAE,OAAe;IAQzE,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IACpC,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IACjC,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAEpC,QAAQ,CAAC,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC;IAChD,QAAQ,CAAC,cAAc,CACrB,IAAI,EAAE,WAAW,GAAG,UAAU,EAC9B,EAAE,CAAC,EAAE,MAAM,GACV,UAAU,GAAG,SAAS;IAEzB,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IACjD,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IACjD,QAAQ,CAAC,cAAc,IAAI,OA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B,aAAa,IAAI,IAAI;IAcrB,kBAAkB,IAAI,IAAI;IA8D1B,yBAAyB,CACvB,aAAa,EAAE,OAAO,GACrB,SAAS,GAAG,uBAAuB;IAUhC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IA+C3B,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAevC,qBAAqB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAa9C,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAoBjC,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBjD,cAAc,CAClB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,YAAY,GAAE,OAAO,GAAG,SAAqB,GAC5C,OAAO,CAAC,IAAI,CAAC;IAyBV,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAc3C,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAWxC,IAAW,eAAe,IAAI,OAAO,CAKpC;CACF","sources":["transports/lib/wavtools/lib/wav_packer.js","transports/lib/wavtools/lib/analysis/constants.js","transports/lib/wavtools/lib/analysis/audio_analysis.js","transports/lib/wavtools/lib/worklets/stream_processor.js","transports/lib/wavtools/lib/wav_stream_player.js","transports/lib/wavtools/lib/worklets/audio_processor.js","transports/lib/wavtools/lib/wav_recorder.js","transports/lib/wavtools/lib/mediastream_recorder.js","transports/lib/wavtools/index.js","transports/lib/media-mgmt/mediaManager.ts","transports/lib/media-mgmt/dailyMediaManager.ts","transports/lib/websocket-utils/reconnectingWebSocket.ts","transports/gemini-live-websocket-transport/src/src/directToLLMBaseWebSocketTransport.ts","transports/gemini-live-websocket-transport/src/src/geminiLiveWebSocketTransport.ts","transports/gemini-live-websocket-transport/src/src/index.ts","transports/gemini-live-websocket-transport/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"export * from \"./geminiLiveWebSocketTransport\";\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/index.js
CHANGED
|
@@ -799,6 +799,7 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
799
799
|
this.outputToSpeakers = outputToSpeakers;
|
|
800
800
|
this.debug = !!debug;
|
|
801
801
|
this._deviceChangeCallback = null;
|
|
802
|
+
this._deviceErrorCallback = null;
|
|
802
803
|
this._devices = [];
|
|
803
804
|
this.deviceSelection = null;
|
|
804
805
|
// State variables
|
|
@@ -957,21 +958,42 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
957
958
|
return true;
|
|
958
959
|
}
|
|
959
960
|
/**
|
|
961
|
+
* Provide a callback for if/when device errors occur
|
|
962
|
+
* @param {(({devices: Array<"cam" | "mic">, type: string, error?: Error}) => void) | null} callback
|
|
963
|
+
* @returns {true}
|
|
964
|
+
*/ listenForDeviceErrors(callback) {
|
|
965
|
+
this._deviceErrorCallback = callback;
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
960
968
|
* Manually request permission to use the microphone
|
|
961
969
|
* @returns {Promise<true>}
|
|
962
970
|
*/ async requestPermission() {
|
|
963
971
|
const permissionStatus = await navigator.permissions.query({
|
|
964
972
|
name: 'microphone'
|
|
965
973
|
});
|
|
966
|
-
if (permissionStatus.state === 'denied')
|
|
967
|
-
|
|
974
|
+
if (permissionStatus.state === 'denied') {
|
|
975
|
+
if (this._deviceErrorCallback) this._deviceErrorCallback({
|
|
976
|
+
devices: [
|
|
977
|
+
"mic"
|
|
978
|
+
],
|
|
979
|
+
type: "unknown",
|
|
980
|
+
error: new Error("Microphone access denied")
|
|
981
|
+
});
|
|
982
|
+
} else if (permissionStatus.state === 'prompt') try {
|
|
968
983
|
const stream = await navigator.mediaDevices.getUserMedia({
|
|
969
984
|
audio: true
|
|
970
985
|
});
|
|
971
986
|
const tracks = stream.getTracks();
|
|
972
987
|
tracks.forEach((track)=>track.stop());
|
|
973
988
|
} catch (e) {
|
|
974
|
-
|
|
989
|
+
console.error("Error accessing microphone.");
|
|
990
|
+
if (this._deviceErrorCallback) this._deviceErrorCallback({
|
|
991
|
+
devices: [
|
|
992
|
+
"mic"
|
|
993
|
+
],
|
|
994
|
+
type: "unknown",
|
|
995
|
+
error: e
|
|
996
|
+
});
|
|
975
997
|
}
|
|
976
998
|
return true;
|
|
977
999
|
}
|
|
@@ -1008,7 +1030,16 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
1008
1030
|
* @returns {Promise<true>}
|
|
1009
1031
|
*/ async begin(deviceId) {
|
|
1010
1032
|
if (this.processor) throw new Error(`Already connected: please call .end() to start a new session`);
|
|
1011
|
-
if (!navigator.mediaDevices || !('getUserMedia' in navigator.mediaDevices))
|
|
1033
|
+
if (!navigator.mediaDevices || !('getUserMedia' in navigator.mediaDevices)) {
|
|
1034
|
+
if (this._deviceErrorCallback) this._deviceErrorCallback({
|
|
1035
|
+
devices: [
|
|
1036
|
+
"mic",
|
|
1037
|
+
"cam"
|
|
1038
|
+
],
|
|
1039
|
+
type: "undefined-mediadevices"
|
|
1040
|
+
});
|
|
1041
|
+
throw new Error('Could not request user media');
|
|
1042
|
+
}
|
|
1012
1043
|
deviceId = deviceId ?? this.deviceSelection?.deviceId;
|
|
1013
1044
|
try {
|
|
1014
1045
|
const config = {
|
|
@@ -1021,6 +1052,13 @@ class $0d471c38435bdab6$export$439b217ca659a877 {
|
|
|
1021
1052
|
};
|
|
1022
1053
|
this.stream = await navigator.mediaDevices.getUserMedia(config);
|
|
1023
1054
|
} catch (err) {
|
|
1055
|
+
if (this._deviceErrorCallback) this._deviceErrorCallback({
|
|
1056
|
+
devices: [
|
|
1057
|
+
"mic"
|
|
1058
|
+
],
|
|
1059
|
+
type: "unknown",
|
|
1060
|
+
error: err
|
|
1061
|
+
});
|
|
1024
1062
|
throw new Error('Could not start media stream');
|
|
1025
1063
|
}
|
|
1026
1064
|
this.listDevices().then((devices)=>{
|
|
@@ -1441,6 +1479,7 @@ globalThis.WavRecorder = WavRecorder;
|
|
|
1441
1479
|
|
|
1442
1480
|
|
|
1443
1481
|
|
|
1482
|
+
|
|
1444
1483
|
var $23859655abfc5f5c$var$__extends = undefined && undefined.__extends || function() {
|
|
1445
1484
|
var extendStatics = function(d, b) {
|
|
1446
1485
|
extendStatics = Object.setPrototypeOf || ({
|
|
@@ -1618,22 +1657,42 @@ var $23859655abfc5f5c$export$45c5b9bfba2f6304 = /** @class */ function(_super) {
|
|
|
1618
1657
|
}
|
|
1619
1658
|
WavMediaManager.prototype.initialize = function() {
|
|
1620
1659
|
return $23859655abfc5f5c$var$__awaiter(this, void 0, Promise, function() {
|
|
1660
|
+
var error_1;
|
|
1621
1661
|
return $23859655abfc5f5c$var$__generator(this, function(_a) {
|
|
1622
1662
|
switch(_a.label){
|
|
1623
1663
|
case 0:
|
|
1664
|
+
_a.trys.push([
|
|
1665
|
+
0,
|
|
1666
|
+
2,
|
|
1667
|
+
,
|
|
1668
|
+
3
|
|
1669
|
+
]);
|
|
1624
1670
|
return [
|
|
1625
1671
|
4 /*yield*/ ,
|
|
1626
1672
|
this._wavRecorder.begin()
|
|
1627
1673
|
];
|
|
1628
1674
|
case 1:
|
|
1629
1675
|
_a.sent();
|
|
1676
|
+
return [
|
|
1677
|
+
3 /*break*/ ,
|
|
1678
|
+
3
|
|
1679
|
+
];
|
|
1680
|
+
case 2:
|
|
1681
|
+
error_1 = _a.sent();
|
|
1682
|
+
return [
|
|
1683
|
+
3 /*break*/ ,
|
|
1684
|
+
3
|
|
1685
|
+
];
|
|
1686
|
+
case 3:
|
|
1630
1687
|
this._wavRecorder.listenForDeviceChange(null);
|
|
1631
1688
|
this._wavRecorder.listenForDeviceChange(this._handleAvailableDevicesUpdated.bind(this));
|
|
1689
|
+
this._wavRecorder.listenForDeviceErrors(null);
|
|
1690
|
+
this._wavRecorder.listenForDeviceErrors(this._handleDeviceError.bind(this));
|
|
1632
1691
|
return [
|
|
1633
1692
|
4 /*yield*/ ,
|
|
1634
1693
|
this._wavStreamPlayer.connect()
|
|
1635
1694
|
];
|
|
1636
|
-
case
|
|
1695
|
+
case 4:
|
|
1637
1696
|
_a.sent();
|
|
1638
1697
|
this._initialized = true;
|
|
1639
1698
|
return [
|
|
@@ -1674,6 +1733,7 @@ var $23859655abfc5f5c$export$45c5b9bfba2f6304 = /** @class */ function(_super) {
|
|
|
1674
1733
|
_a.sent();
|
|
1675
1734
|
_a.label = 4;
|
|
1676
1735
|
case 4:
|
|
1736
|
+
if (this._camEnabled) console.warn("WavMediaManager does not support video input.");
|
|
1677
1737
|
return [
|
|
1678
1738
|
2 /*return*/
|
|
1679
1739
|
];
|
|
@@ -1735,38 +1795,61 @@ var $23859655abfc5f5c$export$45c5b9bfba2f6304 = /** @class */ function(_super) {
|
|
|
1735
1795
|
};
|
|
1736
1796
|
WavMediaManager.prototype.updateMic = function(micId) {
|
|
1737
1797
|
return $23859655abfc5f5c$var$__awaiter(this, void 0, Promise, function() {
|
|
1738
|
-
var prevMic, curMic;
|
|
1798
|
+
var prevMic, curMic, error_2;
|
|
1739
1799
|
var _a, _b;
|
|
1740
1800
|
return $23859655abfc5f5c$var$__generator(this, function(_c) {
|
|
1741
1801
|
switch(_c.label){
|
|
1742
1802
|
case 0:
|
|
1743
1803
|
prevMic = this._wavRecorder.deviceSelection;
|
|
1804
|
+
if (!(this._wavRecorder.getStatus() !== "ended")) return [
|
|
1805
|
+
3 /*break*/ ,
|
|
1806
|
+
2
|
|
1807
|
+
];
|
|
1744
1808
|
return [
|
|
1745
1809
|
4 /*yield*/ ,
|
|
1746
1810
|
this._wavRecorder.end()
|
|
1747
1811
|
];
|
|
1748
1812
|
case 1:
|
|
1749
1813
|
_c.sent();
|
|
1814
|
+
_c.label = 2;
|
|
1815
|
+
case 2:
|
|
1816
|
+
_c.trys.push([
|
|
1817
|
+
2,
|
|
1818
|
+
6,
|
|
1819
|
+
,
|
|
1820
|
+
7
|
|
1821
|
+
]);
|
|
1750
1822
|
return [
|
|
1751
1823
|
4 /*yield*/ ,
|
|
1752
1824
|
this._wavRecorder.begin(micId)
|
|
1753
1825
|
];
|
|
1754
|
-
case
|
|
1826
|
+
case 3:
|
|
1755
1827
|
_c.sent();
|
|
1756
1828
|
if (!this._micEnabled) return [
|
|
1757
1829
|
3 /*break*/ ,
|
|
1758
|
-
|
|
1830
|
+
5
|
|
1759
1831
|
];
|
|
1760
1832
|
return [
|
|
1761
1833
|
4 /*yield*/ ,
|
|
1762
1834
|
this._startRecording()
|
|
1763
1835
|
];
|
|
1764
|
-
case 3:
|
|
1765
|
-
_c.sent();
|
|
1766
|
-
_c.label = 4;
|
|
1767
1836
|
case 4:
|
|
1837
|
+
_c.sent();
|
|
1838
|
+
_c.label = 5;
|
|
1839
|
+
case 5:
|
|
1768
1840
|
curMic = this._wavRecorder.deviceSelection;
|
|
1769
1841
|
if (curMic && prevMic && prevMic.label !== curMic.label) (_b = (_a = this._callbacks).onMicUpdated) === null || _b === void 0 || _b.call(_a, curMic);
|
|
1842
|
+
return [
|
|
1843
|
+
3 /*break*/ ,
|
|
1844
|
+
7
|
|
1845
|
+
];
|
|
1846
|
+
case 6:
|
|
1847
|
+
error_2 = _c.sent();
|
|
1848
|
+
return [
|
|
1849
|
+
3 /*break*/ ,
|
|
1850
|
+
7
|
|
1851
|
+
];
|
|
1852
|
+
case 7:
|
|
1770
1853
|
return [
|
|
1771
1854
|
2 /*return*/
|
|
1772
1855
|
];
|
|
@@ -1850,7 +1933,8 @@ var $23859655abfc5f5c$export$45c5b9bfba2f6304 = /** @class */ function(_super) {
|
|
|
1850
1933
|
});
|
|
1851
1934
|
};
|
|
1852
1935
|
WavMediaManager.prototype.enableCam = function(enable) {
|
|
1853
|
-
|
|
1936
|
+
// TODO: Video not supported yet
|
|
1937
|
+
console.warn("WavMediaManager does not support video input.");
|
|
1854
1938
|
};
|
|
1855
1939
|
Object.defineProperty(WavMediaManager.prototype, "isCamEnabled", {
|
|
1856
1940
|
get: function() {
|
|
@@ -1887,7 +1971,8 @@ var $23859655abfc5f5c$export$45c5b9bfba2f6304 = /** @class */ function(_super) {
|
|
|
1887
1971
|
return [
|
|
1888
1972
|
4 /*yield*/ ,
|
|
1889
1973
|
this._wavRecorder.record(function(data) {
|
|
1890
|
-
|
|
1974
|
+
var _a;
|
|
1975
|
+
(_a = _this._userAudioCallback) === null || _a === void 0 || _a.call(_this, data.mono);
|
|
1891
1976
|
}, this._recorderChunkSize)
|
|
1892
1977
|
];
|
|
1893
1978
|
case 1:
|
|
@@ -1919,6 +2004,14 @@ var $23859655abfc5f5c$export$45c5b9bfba2f6304 = /** @class */ function(_super) {
|
|
|
1919
2004
|
return d.deviceId === currentDevice.deviceId;
|
|
1920
2005
|
}) || currentDevice.deviceId === "default" && currentDevice.label !== (defaultDevice === null || defaultDevice === void 0 ? void 0 : defaultDevice.label))) this.updateMic("");
|
|
1921
2006
|
};
|
|
2007
|
+
WavMediaManager.prototype._handleDeviceError = function(_a) {
|
|
2008
|
+
var _b, _c;
|
|
2009
|
+
var devices = _a.devices, type = _a.type, error = _a.error;
|
|
2010
|
+
var deviceError = new (0, $hu5CE$pipecataiclientjs.DeviceError)(devices, type, error === null || error === void 0 ? void 0 : error.message, error ? {
|
|
2011
|
+
sourceError: error
|
|
2012
|
+
} : undefined);
|
|
2013
|
+
(_c = (_b = this._callbacks).onDeviceError) === null || _c === void 0 || _c.call(_b, deviceError);
|
|
2014
|
+
};
|
|
1922
2015
|
return WavMediaManager;
|
|
1923
2016
|
}($23859655abfc5f5c$export$4a0c46dbbe2ddb67);
|
|
1924
2017
|
var $23859655abfc5f5c$var$localParticipant = function() {
|
|
@@ -1932,6 +2025,7 @@ var $23859655abfc5f5c$var$localParticipant = function() {
|
|
|
1932
2025
|
|
|
1933
2026
|
|
|
1934
2027
|
|
|
2028
|
+
|
|
1935
2029
|
var $1c088932741d88e6$var$__extends = undefined && undefined.__extends || function() {
|
|
1936
2030
|
var extendStatics = function(d, b) {
|
|
1937
2031
|
extendStatics = Object.setPrototypeOf || ({
|
|
@@ -2103,6 +2197,7 @@ var $1c088932741d88e6$export$c95c65abc5f47125 = /** @class */ function(_super) {
|
|
|
2103
2197
|
_this._daily.on("track-stopped", _this.handleTrackStopped.bind(_this));
|
|
2104
2198
|
_this._daily.on("available-devices-updated", _this._handleAvailableDevicesUpdated.bind(_this));
|
|
2105
2199
|
_this._daily.on("selected-devices-updated", _this._handleSelectedDevicesUpdated.bind(_this));
|
|
2200
|
+
_this._daily.on("camera-error", _this.handleDeviceError.bind(_this));
|
|
2106
2201
|
_this._daily.on("local-audio-level", _this._handleLocalAudioLevel.bind(_this));
|
|
2107
2202
|
return _this;
|
|
2108
2203
|
}
|
|
@@ -2517,6 +2612,50 @@ var $1c088932741d88e6$export$c95c65abc5f47125 = /** @class */ function(_super) {
|
|
|
2517
2612
|
(_f = (_e = this._callbacks).onMicUpdated) === null || _f === void 0 || _f.call(_e, event.devices.mic);
|
|
2518
2613
|
}
|
|
2519
2614
|
};
|
|
2615
|
+
DailyMediaManager.prototype.handleDeviceError = function(ev) {
|
|
2616
|
+
var _a, _b;
|
|
2617
|
+
var generateDeviceError = function(error) {
|
|
2618
|
+
var devices = [];
|
|
2619
|
+
switch(error.type){
|
|
2620
|
+
case "permissions":
|
|
2621
|
+
error.blockedMedia.forEach(function(d) {
|
|
2622
|
+
devices.push(d === "video" ? "cam" : "mic");
|
|
2623
|
+
});
|
|
2624
|
+
return new (0, $hu5CE$pipecataiclientjs.DeviceError)(devices, error.type, error.msg, {
|
|
2625
|
+
blockedBy: error.blockedBy
|
|
2626
|
+
});
|
|
2627
|
+
case "not-found":
|
|
2628
|
+
error.missingMedia.forEach(function(d) {
|
|
2629
|
+
devices.push(d === "video" ? "cam" : "mic");
|
|
2630
|
+
});
|
|
2631
|
+
return new (0, $hu5CE$pipecataiclientjs.DeviceError)(devices, error.type, error.msg);
|
|
2632
|
+
case "constraints":
|
|
2633
|
+
error.failedMedia.forEach(function(d) {
|
|
2634
|
+
devices.push(d === "video" ? "cam" : "mic");
|
|
2635
|
+
});
|
|
2636
|
+
return new (0, $hu5CE$pipecataiclientjs.DeviceError)(devices, error.type, error.msg, {
|
|
2637
|
+
reason: error.reason
|
|
2638
|
+
});
|
|
2639
|
+
case "cam-in-use":
|
|
2640
|
+
devices.push("cam");
|
|
2641
|
+
return new (0, $hu5CE$pipecataiclientjs.DeviceError)(devices, "in-use", error.msg);
|
|
2642
|
+
case "mic-in-use":
|
|
2643
|
+
devices.push("mic");
|
|
2644
|
+
return new (0, $hu5CE$pipecataiclientjs.DeviceError)(devices, "in-use", error.msg);
|
|
2645
|
+
case "cam-mic-in-use":
|
|
2646
|
+
devices.push("cam");
|
|
2647
|
+
devices.push("mic");
|
|
2648
|
+
return new (0, $hu5CE$pipecataiclientjs.DeviceError)(devices, "in-use", error.msg);
|
|
2649
|
+
case "undefined-mediadevices":
|
|
2650
|
+
case "unknown":
|
|
2651
|
+
default:
|
|
2652
|
+
devices.push("cam");
|
|
2653
|
+
devices.push("mic");
|
|
2654
|
+
return new (0, $hu5CE$pipecataiclientjs.DeviceError)(devices, error.type, error.msg);
|
|
2655
|
+
}
|
|
2656
|
+
};
|
|
2657
|
+
(_b = (_a = this._callbacks).onDeviceError) === null || _b === void 0 || _b.call(_a, generateDeviceError(ev.error));
|
|
2658
|
+
};
|
|
2520
2659
|
DailyMediaManager.prototype._handleLocalAudioLevel = function(ev) {
|
|
2521
2660
|
var _a, _b;
|
|
2522
2661
|
(_b = (_a = this._callbacks).onLocalAudioLevel) === null || _b === void 0 || _b.call(_a, ev.audioLevel);
|
|
@@ -2527,7 +2666,7 @@ var $1c088932741d88e6$export$c95c65abc5f47125 = /** @class */ function(_super) {
|
|
|
2527
2666
|
};
|
|
2528
2667
|
DailyMediaManager.prototype.handleTrackStarted = function(event) {
|
|
2529
2668
|
return $1c088932741d88e6$var$__awaiter(this, void 0, void 0, function() {
|
|
2530
|
-
var status, _a;
|
|
2669
|
+
var status, _a, e_1, e_2;
|
|
2531
2670
|
var _b, _c, _d, _e;
|
|
2532
2671
|
return $1c088932741d88e6$var$__generator(this, function(_f) {
|
|
2533
2672
|
switch(_f.label){
|
|
@@ -2537,11 +2676,11 @@ var $1c088932741d88e6$export$c95c65abc5f47125 = /** @class */ function(_super) {
|
|
|
2537
2676
|
];
|
|
2538
2677
|
if (!(event.track.kind === "audio")) return [
|
|
2539
2678
|
3 /*break*/ ,
|
|
2540
|
-
|
|
2679
|
+
15
|
|
2541
2680
|
];
|
|
2542
2681
|
if (!this._mediaStreamRecorder) return [
|
|
2543
2682
|
3 /*break*/ ,
|
|
2544
|
-
|
|
2683
|
+
14
|
|
2545
2684
|
];
|
|
2546
2685
|
status = this._mediaStreamRecorder.getStatus();
|
|
2547
2686
|
_a = status;
|
|
@@ -2554,19 +2693,25 @@ var $1c088932741d88e6$export$c95c65abc5f47125 = /** @class */ function(_super) {
|
|
|
2554
2693
|
case "paused":
|
|
2555
2694
|
return [
|
|
2556
2695
|
3 /*break*/ ,
|
|
2557
|
-
|
|
2696
|
+
5
|
|
2558
2697
|
];
|
|
2559
2698
|
case "recording":
|
|
2560
2699
|
return [
|
|
2561
2700
|
3 /*break*/ ,
|
|
2562
|
-
|
|
2701
|
+
6
|
|
2563
2702
|
];
|
|
2564
2703
|
}
|
|
2565
2704
|
return [
|
|
2566
2705
|
3 /*break*/ ,
|
|
2567
|
-
|
|
2706
|
+
6
|
|
2568
2707
|
];
|
|
2569
2708
|
case 1:
|
|
2709
|
+
_f.trys.push([
|
|
2710
|
+
1,
|
|
2711
|
+
3,
|
|
2712
|
+
,
|
|
2713
|
+
4
|
|
2714
|
+
]);
|
|
2570
2715
|
return [
|
|
2571
2716
|
4 /*yield*/ ,
|
|
2572
2717
|
this._mediaStreamRecorder.begin(event.track)
|
|
@@ -2582,48 +2727,78 @@ var $1c088932741d88e6$export$c95c65abc5f47125 = /** @class */ function(_super) {
|
|
|
2582
2727
|
}
|
|
2583
2728
|
return [
|
|
2584
2729
|
3 /*break*/ ,
|
|
2585
|
-
|
|
2730
|
+
4
|
|
2586
2731
|
];
|
|
2587
2732
|
case 3:
|
|
2588
|
-
|
|
2733
|
+
e_1 = _f.sent();
|
|
2589
2734
|
return [
|
|
2590
2735
|
3 /*break*/ ,
|
|
2591
|
-
|
|
2736
|
+
4
|
|
2592
2737
|
];
|
|
2593
2738
|
case 4:
|
|
2739
|
+
return [
|
|
2740
|
+
3 /*break*/ ,
|
|
2741
|
+
14
|
|
2742
|
+
];
|
|
2743
|
+
case 5:
|
|
2744
|
+
this._startRecording();
|
|
2745
|
+
return [
|
|
2746
|
+
3 /*break*/ ,
|
|
2747
|
+
14
|
|
2748
|
+
];
|
|
2749
|
+
case 6:
|
|
2594
2750
|
if (!(this._currentAudioTrack !== event.track)) return [
|
|
2595
2751
|
3 /*break*/ ,
|
|
2596
|
-
|
|
2752
|
+
12
|
|
2597
2753
|
];
|
|
2598
2754
|
return [
|
|
2599
2755
|
4 /*yield*/ ,
|
|
2600
2756
|
this._mediaStreamRecorder.end()
|
|
2601
2757
|
];
|
|
2602
|
-
case
|
|
2758
|
+
case 7:
|
|
2603
2759
|
_f.sent();
|
|
2760
|
+
_f.label = 8;
|
|
2761
|
+
case 8:
|
|
2762
|
+
_f.trys.push([
|
|
2763
|
+
8,
|
|
2764
|
+
10,
|
|
2765
|
+
,
|
|
2766
|
+
11
|
|
2767
|
+
]);
|
|
2604
2768
|
return [
|
|
2605
2769
|
4 /*yield*/ ,
|
|
2606
2770
|
this._mediaStreamRecorder.begin(event.track)
|
|
2607
2771
|
];
|
|
2608
|
-
case
|
|
2772
|
+
case 9:
|
|
2609
2773
|
_f.sent();
|
|
2610
2774
|
this._startRecording();
|
|
2611
2775
|
return [
|
|
2612
2776
|
3 /*break*/ ,
|
|
2613
|
-
|
|
2777
|
+
11
|
|
2614
2778
|
];
|
|
2615
|
-
case
|
|
2779
|
+
case 10:
|
|
2780
|
+
e_2 = _f.sent();
|
|
2781
|
+
return [
|
|
2782
|
+
3 /*break*/ ,
|
|
2783
|
+
11
|
|
2784
|
+
];
|
|
2785
|
+
case 11:
|
|
2786
|
+
return [
|
|
2787
|
+
3 /*break*/ ,
|
|
2788
|
+
13
|
|
2789
|
+
];
|
|
2790
|
+
case 12:
|
|
2616
2791
|
console.warn("track-started event received for current track and already recording");
|
|
2617
|
-
_f.label =
|
|
2618
|
-
case
|
|
2792
|
+
_f.label = 13;
|
|
2793
|
+
case 13:
|
|
2619
2794
|
return [
|
|
2620
2795
|
3 /*break*/ ,
|
|
2621
|
-
|
|
2796
|
+
14
|
|
2622
2797
|
];
|
|
2623
|
-
case
|
|
2798
|
+
case 14:
|
|
2624
2799
|
this._currentAudioTrack = event.track;
|
|
2625
|
-
_f.label =
|
|
2626
|
-
case
|
|
2800
|
+
_f.label = 15;
|
|
2801
|
+
case 15:
|
|
2627
2802
|
(_d = (_c = this._callbacks).onTrackStarted) === null || _d === void 0 || _d.call(_c, event.track, event.participant ? $1c088932741d88e6$var$dailyParticipantToParticipant(event.participant) : undefined);
|
|
2628
2803
|
(_e = this.onTrackStartedCallback) === null || _e === void 0 || _e.call(this, event);
|
|
2629
2804
|
return [
|