@stinkycomputing/sesame-api-client 1.4.1-alpha.7 → 1.4.1-alpha.8

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 CHANGED
@@ -22,5 +22,9 @@ export { RPCClient, IClientOptions, IProtobufType } from './rpc-client';
22
22
  export { SesameConnection, IConnectionOptions, VideoCallback, AudioCallback, waitForEvent } from './sesame-connection';
23
23
  export { SesameBinaryProtocol, PacketType, CodecType } from './sesame-binary-protocol';
24
24
  export { SesameClient, EaseKind } from './sesame-api-client';
25
+ export { StatusApi } from './status-api';
26
+ export { RecorderApi } from './recorder-api';
27
+ export { JobsApi } from './jobs-api';
28
+ export type { TopicDataCallback } from './sesame-api-client';
25
29
  export { setLogger, getLogger, log, ILogger } from './logger';
26
30
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,QAAA,MAAM,OAAO,8BAAwB,CAAC;AACtC,QAAA,MAAM,OAAO,8BAAwB,CAAC;AACtC,QAAA,MAAM,QAAQ,+BAAyB,CAAC;AACxC,QAAA,MAAM,KAAK,4BAAsB,CAAC;AAElC,KAAK,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;AACvC,KAAK,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC;AACvC,KAAK,SAAS,GAAG,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC;AACzC,KAAK,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACrD,YAAY,EA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M,UAAU,CAAC"}
package/dist/index.mjs CHANGED
@@ -8180,7 +8180,7 @@ var sesame = $root.sesame = (() => {
8180
8180
  RecorderClip.prototype.endTimeUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
8181
8181
  RecorderClip.prototype.lockedStartUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
8182
8182
  RecorderClip.prototype.lockedEndUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
8183
- RecorderClip.prototype.userTimeUs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
8183
+ RecorderClip.prototype.userTimeMs = $util.Long ? $util.Long.fromBits(0, 0, false) : 0;
8184
8184
  RecorderClip.create = function create(properties) {
8185
8185
  return new RecorderClip(properties);
8186
8186
  };
@@ -8227,11 +8227,11 @@ var sesame = $root.sesame = (() => {
8227
8227
  /* id 8, wireType 0 =*/
8228
8228
  64
8229
8229
  ).int64(message.lockedEndUs);
8230
- if (message.userTimeUs != null && Object.hasOwnProperty.call(message, "userTimeUs"))
8230
+ if (message.userTimeMs != null && Object.hasOwnProperty.call(message, "userTimeMs"))
8231
8231
  writer.uint32(
8232
8232
  /* id 9, wireType 0 =*/
8233
8233
  72
8234
- ).int64(message.userTimeUs);
8234
+ ).int64(message.userTimeMs);
8235
8235
  return writer;
8236
8236
  };
8237
8237
  RecorderClip.encodeDelimited = function encodeDelimited(message, writer) {
@@ -8279,7 +8279,7 @@ var sesame = $root.sesame = (() => {
8279
8279
  break;
8280
8280
  }
8281
8281
  case 9: {
8282
- message.userTimeUs = reader.int64();
8282
+ message.userTimeMs = reader.int64();
8283
8283
  break;
8284
8284
  }
8285
8285
  default:
@@ -8329,9 +8329,9 @@ var sesame = $root.sesame = (() => {
8329
8329
  if (!$util.isInteger(message.lockedEndUs) && !(message.lockedEndUs && $util.isInteger(message.lockedEndUs.low) && $util.isInteger(message.lockedEndUs.high)))
8330
8330
  return "lockedEndUs: integer|Long expected";
8331
8331
  }
8332
- if (message.userTimeUs != null && message.hasOwnProperty("userTimeUs")) {
8333
- if (!$util.isInteger(message.userTimeUs) && !(message.userTimeUs && $util.isInteger(message.userTimeUs.low) && $util.isInteger(message.userTimeUs.high)))
8334
- return "userTimeUs: integer|Long expected";
8332
+ if (message.userTimeMs != null && message.hasOwnProperty("userTimeMs")) {
8333
+ if (!$util.isInteger(message.userTimeMs) && !(message.userTimeMs && $util.isInteger(message.userTimeMs.low) && $util.isInteger(message.userTimeMs.high)))
8334
+ return "userTimeMs: integer|Long expected";
8335
8335
  }
8336
8336
  return null;
8337
8337
  };
@@ -8403,15 +8403,15 @@ var sesame = $root.sesame = (() => {
8403
8403
  else if (typeof object.lockedEndUs === "object")
8404
8404
  message.lockedEndUs = new $util.LongBits(object.lockedEndUs.low >>> 0, object.lockedEndUs.high >>> 0).toNumber();
8405
8405
  }
8406
- if (object.userTimeUs != null) {
8406
+ if (object.userTimeMs != null) {
8407
8407
  if ($util.Long)
8408
- (message.userTimeUs = $util.Long.fromValue(object.userTimeUs)).unsigned = false;
8409
- else if (typeof object.userTimeUs === "string")
8410
- message.userTimeUs = parseInt(object.userTimeUs, 10);
8411
- else if (typeof object.userTimeUs === "number")
8412
- message.userTimeUs = object.userTimeUs;
8413
- else if (typeof object.userTimeUs === "object")
8414
- message.userTimeUs = new $util.LongBits(object.userTimeUs.low >>> 0, object.userTimeUs.high >>> 0).toNumber();
8408
+ (message.userTimeMs = $util.Long.fromValue(object.userTimeMs)).unsigned = false;
8409
+ else if (typeof object.userTimeMs === "string")
8410
+ message.userTimeMs = parseInt(object.userTimeMs, 10);
8411
+ else if (typeof object.userTimeMs === "number")
8412
+ message.userTimeMs = object.userTimeMs;
8413
+ else if (typeof object.userTimeMs === "object")
8414
+ message.userTimeMs = new $util.LongBits(object.userTimeMs.low >>> 0, object.userTimeMs.high >>> 0).toNumber();
8415
8415
  }
8416
8416
  return message;
8417
8417
  };
@@ -8454,9 +8454,9 @@ var sesame = $root.sesame = (() => {
8454
8454
  object.lockedEndUs = options.longs === String ? "0" : 0;
8455
8455
  if ($util.Long) {
8456
8456
  let long = new $util.Long(0, 0, false);
8457
- object.userTimeUs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
8457
+ object.userTimeMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
8458
8458
  } else
8459
- object.userTimeUs = options.longs === String ? "0" : 0;
8459
+ object.userTimeMs = options.longs === String ? "0" : 0;
8460
8460
  }
8461
8461
  if (message.id != null && message.hasOwnProperty("id"))
8462
8462
  if (typeof message.id === "number")
@@ -8492,11 +8492,11 @@ var sesame = $root.sesame = (() => {
8492
8492
  object.lockedEndUs = options.longs === String ? String(message.lockedEndUs) : message.lockedEndUs;
8493
8493
  else
8494
8494
  object.lockedEndUs = options.longs === String ? $util.Long.prototype.toString.call(message.lockedEndUs) : options.longs === Number ? new $util.LongBits(message.lockedEndUs.low >>> 0, message.lockedEndUs.high >>> 0).toNumber() : message.lockedEndUs;
8495
- if (message.userTimeUs != null && message.hasOwnProperty("userTimeUs"))
8496
- if (typeof message.userTimeUs === "number")
8497
- object.userTimeUs = options.longs === String ? String(message.userTimeUs) : message.userTimeUs;
8495
+ if (message.userTimeMs != null && message.hasOwnProperty("userTimeMs"))
8496
+ if (typeof message.userTimeMs === "number")
8497
+ object.userTimeMs = options.longs === String ? String(message.userTimeMs) : message.userTimeMs;
8498
8498
  else
8499
- object.userTimeUs = options.longs === String ? $util.Long.prototype.toString.call(message.userTimeUs) : options.longs === Number ? new $util.LongBits(message.userTimeUs.low >>> 0, message.userTimeUs.high >>> 0).toNumber() : message.userTimeUs;
8499
+ object.userTimeMs = options.longs === String ? $util.Long.prototype.toString.call(message.userTimeMs) : options.longs === Number ? new $util.LongBits(message.userTimeMs.low >>> 0, message.userTimeMs.high >>> 0).toNumber() : message.userTimeMs;
8500
8500
  return object;
8501
8501
  };
8502
8502
  RecorderClip.prototype.toJSON = function toJSON() {
@@ -21879,6 +21879,133 @@ var defaultBackoff = (tries) => {
21879
21879
 
21880
21880
  // src/sesame-api-client.ts
21881
21881
  import { EventEmitter as EventEmitter3 } from "events";
21882
+
21883
+ // src/status-api.ts
21884
+ var StatusApi = class {
21885
+ /** @internal */
21886
+ constructor(rpc2) {
21887
+ this.rpc = rpc2;
21888
+ }
21889
+ async getStatus() {
21890
+ return this.rpc.service.requestStatus(new sesame.v1.common.Empty());
21891
+ }
21892
+ async getIODevices() {
21893
+ return this.rpc.service.requestIODeviceList(new sesame.v1.common.Empty());
21894
+ }
21895
+ async requestKeyframe(outputId) {
21896
+ await this.rpc.service.requestKeyframe({ id: outputId });
21897
+ }
21898
+ };
21899
+
21900
+ // src/recorder-api.ts
21901
+ var RecorderApi = class {
21902
+ /** @internal */
21903
+ constructor(rpc2) {
21904
+ this.rpc = rpc2;
21905
+ }
21906
+ async addClip(recorderId, clip) {
21907
+ const msg = sesame.v1.recorder.RecorderClipAddRequest.create({ clip });
21908
+ await this.rpc.service.requestRecorderOperation({ recorderId, addClip: msg });
21909
+ }
21910
+ async copyClip(recorderId, clipId, newClipId) {
21911
+ const msg = sesame.v1.recorder.RecorderClipCopyRequest.create({ clipId, newClipId });
21912
+ await this.rpc.service.requestRecorderOperation({ recorderId, copyClip: msg });
21913
+ }
21914
+ async removeClip(recorderId, id) {
21915
+ const msg = sesame.v1.recorder.RecorderClipRemoveRequest.create({ clipId: id });
21916
+ await this.rpc.service.requestRecorderOperation({ recorderId, removeClip: msg });
21917
+ }
21918
+ async removeAllClips(recorderId, protect) {
21919
+ const msg = sesame.v1.recorder.RecorderClipsClearRequest.create();
21920
+ if (protect) msg.protectedRanges = protect;
21921
+ await this.rpc.service.requestRecorderOperation({ recorderId, clearClips: msg });
21922
+ }
21923
+ async verifyClips(recorderId) {
21924
+ var _a;
21925
+ const msg = sesame.v1.recorder.RecorderClipsVerifyRequest.create();
21926
+ const reply = await this.rpc.service.requestRecorderOperation({ recorderId, verifyClips: msg });
21927
+ return ((_a = reply.verifyClipsResponse) == null ? void 0 : _a.errors) || [];
21928
+ }
21929
+ async getClips(recorderId) {
21930
+ var _a;
21931
+ const msg = sesame.v1.recorder.RecorderClipsGetRequest.create();
21932
+ const reply = await this.rpc.service.requestRecorderOperation({ recorderId, getClips: msg });
21933
+ if ((_a = reply.getClipsResponse) == null ? void 0 : _a.clips) {
21934
+ return reply.getClipsResponse.clips;
21935
+ } else {
21936
+ throw new Error(`No clips returned: ${JSON.stringify(reply)}`);
21937
+ }
21938
+ }
21939
+ async setLockedDuration(frames) {
21940
+ const msg = sesame.v1.recorder.RecorderLockedDurationSetRequest.create({ frames });
21941
+ await this.rpc.service.requestRecorderOperation({ recorderId: "", setLockedDuration: msg });
21942
+ }
21943
+ async setMetadata(recorderId, metadata) {
21944
+ const msg = sesame.v1.recorder.RecorderMetadataSetRequest.create({ metadata });
21945
+ await this.rpc.service.requestRecorderOperation({ recorderId, setMetadata: msg });
21946
+ }
21947
+ };
21948
+
21949
+ // src/jobs-api.ts
21950
+ var JobsApi = class {
21951
+ /** @internal */
21952
+ constructor(rpc2) {
21953
+ this.rpc = rpc2;
21954
+ }
21955
+ async importClip(config) {
21956
+ const msg = sesame.v1.jobs.ImportStartRequest.create();
21957
+ msg.config = config;
21958
+ const res = await this.rpc.service.requestClipImportStart(msg);
21959
+ if (res.error) {
21960
+ throw new Error(res.error);
21961
+ }
21962
+ return res;
21963
+ }
21964
+ async getImportStatus() {
21965
+ const msg = sesame.v1.jobs.ImportListRequest.create();
21966
+ return this.rpc.service.requestClipImportList(msg);
21967
+ }
21968
+ async abortImport(jobId) {
21969
+ const msg = { jobId };
21970
+ return this.rpc.service.requestClipImportAbort(msg);
21971
+ }
21972
+ async exportPlaylist(playlist, config) {
21973
+ const msg = sesame.v1.jobs.ExportStartRequest.create();
21974
+ if (!config.filename) throw new Error("Filename is required");
21975
+ msg.config = {
21976
+ ...config,
21977
+ filename: config.filename,
21978
+ videoCodec: config.videoCodec ?? sesame.v1.common.CodecId.CODEC_ID_H264,
21979
+ videoBitrateKbps: config.videoBitrateKbps ?? 1024,
21980
+ audioCodec: config.audioCodec ?? sesame.v1.jobs.AudioCodecId.AUDIO_CODEC_ID_AAC,
21981
+ audioBitrateKbps: config.audioBitrateKbps ?? 128,
21982
+ audioChannels: config.audioChannels ?? 4,
21983
+ audioRouting: config.audioRouting ?? [0, 1, 2, 3]
21984
+ };
21985
+ msg.items = playlist.clips.map((clip) => ({
21986
+ id: clip.id,
21987
+ recorderId: clip.recorderId,
21988
+ transitionTimeUs: clip.transitionTimeUs ?? 0,
21989
+ transitionType: clip.transitionType ?? sesame.v1.recorder.TransitionType.TRANSITION_TYPE_MIX,
21990
+ transitionFadeColor: clip.transitionFadeColor ?? { x: 0, y: 0, z: 0, w: 0 },
21991
+ speed: clip.speed ?? 1,
21992
+ audioRouting: clip.audioRouting,
21993
+ startTimeUs: clip.startTimeUs,
21994
+ endTimeUs: clip.endTimeUs
21995
+ }));
21996
+ await this.rpc.service.requestPlaylistExportStart(msg);
21997
+ }
21998
+ async getExportStatus() {
21999
+ const msg = sesame.v1.jobs.ExportListRequest.create();
22000
+ return this.rpc.service.requestPlaylistExportList(msg);
22001
+ }
22002
+ async abortExport(jobId) {
22003
+ const msg = { jobId };
22004
+ return this.rpc.service.requestPlaylistExportAbort(msg);
22005
+ }
22006
+ };
22007
+
22008
+ // src/sesame-api-client.ts
21882
22009
  var EaseKind = /* @__PURE__ */ ((EaseKind2) => {
21883
22010
  EaseKind2["STEPPED"] = "stepped";
21884
22011
  EaseKind2["LINEAR"] = "linear";
@@ -21949,6 +22076,9 @@ var SesameClient = class extends EventEmitter3 {
21949
22076
  eventTypes: events
21950
22077
  };
21951
22078
  this.rpc = new RPCClient(this.conn, sesame.v1.rpc.SesameAPIService, options);
22079
+ this.status = new StatusApi(this.rpc);
22080
+ this.recorder = new RecorderApi(this.rpc);
22081
+ this.jobs = new JobsApi(this.rpc);
21952
22082
  this.rpc.on("event", (topic, msg) => {
21953
22083
  for (const subscription of this.subscriptions) {
21954
22084
  if (subscription.topic === topic) {
@@ -21960,57 +22090,46 @@ var SesameClient = class extends EventEmitter3 {
21960
22090
  log.error(`RPC error: ${err.message}`);
21961
22091
  });
21962
22092
  this.conn.on("open", async () => {
21963
- this.send_subscriptions();
22093
+ this.sendSubscriptions();
21964
22094
  this.errorIsLogged = false;
21965
22095
  this.emit("connected");
21966
22096
  });
21967
22097
  this.conn.on("close", () => {
21968
22098
  this.emit("disconnected");
21969
22099
  });
21970
- this.conn.on("video-packet", (data) => this.onVideoPacket(this.video_subscription, data));
21971
- this.conn.on("audio-packet", (data) => this.onAudioPacket(this.video_subscription, data));
22100
+ this.conn.on("video-packet", (data) => this.onVideoPacket(this.videoSubscriptionId, data));
22101
+ this.conn.on("audio-packet", (data) => this.onAudioPacket(this.videoSubscriptionId, data));
21972
22102
  this.subscriptions = [];
21973
22103
  }
21974
22104
  isConnected() {
21975
22105
  return this.conn.isConnected();
21976
22106
  }
21977
- send_subscriptions() {
22107
+ sendSubscriptions() {
21978
22108
  if (!this.isConnected()) return;
21979
22109
  const eventTopics = this.subscriptions.map((subscription) => subscription.topic);
21980
22110
  const channels = [];
21981
- if (this.video_subscription) channels.push(`video/${this.video_subscription}`);
22111
+ if (this.videoSubscriptionId) channels.push(`video/${this.videoSubscriptionId}`);
21982
22112
  let subs = { eventTopics, channels };
21983
22113
  this.rpc.service.updateSubscriptions(subs).catch((err) => {
21984
22114
  log.error(`Failed to update subscriptions: ${err.message}`);
21985
22115
  });
21986
22116
  }
21987
- async get_status() {
21988
- const status = await this.rpc.service.requestStatus(new sesame.v1.common.Empty());
21989
- return status;
21990
- }
21991
- async get_io_devices() {
21992
- const reply = await this.rpc.service.requestIODeviceList(new sesame.v1.common.Empty());
21993
- return reply;
22117
+ addVideoSubscription(id) {
22118
+ this.videoSubscriptionId = id;
22119
+ this.sendSubscriptions();
21994
22120
  }
21995
- async request_keyframe(outputId) {
21996
- await this.rpc.service.requestKeyframe({ id: outputId });
21997
- }
21998
- add_video_subscription(id) {
21999
- this.video_subscription = id;
22000
- this.send_subscriptions();
22001
- }
22002
- add_subscription(topic, callback) {
22121
+ addSubscription(topic, callback) {
22003
22122
  for (let i = 0; i < this.subscriptions.length; i++) {
22004
22123
  if (this.subscriptions[i].callback === callback && this.subscriptions[i].topic === topic) {
22005
22124
  return;
22006
22125
  }
22007
22126
  }
22008
22127
  this.subscriptions.push({ topic, callback });
22009
- this.send_subscriptions();
22128
+ this.sendSubscriptions();
22010
22129
  }
22011
- remove_subscription(topic, callback) {
22130
+ removeSubscription(topic, callback) {
22012
22131
  this.subscriptions = this.subscriptions.filter((s) => !(s.topic === topic && s.callback === callback));
22013
- this.send_subscriptions();
22132
+ this.sendSubscriptions();
22014
22133
  }
22015
22134
  getService() {
22016
22135
  return this.rpc;
@@ -22021,98 +22140,6 @@ var SesameClient = class extends EventEmitter3 {
22021
22140
  await this.rpc.service.executeCommandList(cl.get_command_list_msg());
22022
22141
  }
22023
22142
  }
22024
- async addClip(recorderId, clip) {
22025
- const msg = sesame.v1.recorder.RecorderClipAddRequest.create({ clip });
22026
- await this.rpc.service.requestRecorderOperation({ recorderId, addClip: msg });
22027
- }
22028
- async copyClip(recorderId, clipId, newClipId) {
22029
- const msg = sesame.v1.recorder.RecorderClipCopyRequest.create({ clipId, newClipId });
22030
- await this.rpc.service.requestRecorderOperation({ recorderId, copyClip: msg });
22031
- }
22032
- async removeClip(recorderId, id) {
22033
- const msg = sesame.v1.recorder.RecorderClipRemoveRequest.create({ clipId: id });
22034
- await this.rpc.service.requestRecorderOperation({ recorderId, removeClip: msg });
22035
- }
22036
- async removeAllClips(recorderId, protect) {
22037
- const msg = sesame.v1.recorder.RecorderClipsClearRequest.create();
22038
- if (protect) msg.protectedRanges = protect;
22039
- await this.rpc.service.requestRecorderOperation({ recorderId, clearClips: msg });
22040
- }
22041
- async verifyClips(recorderId) {
22042
- var _a;
22043
- const msg = sesame.v1.recorder.RecorderClipsVerifyRequest.create();
22044
- const reply = await this.rpc.service.requestRecorderOperation({ recorderId, verifyClips: msg });
22045
- return ((_a = reply.verifyClipsResponse) == null ? void 0 : _a.errors) || [];
22046
- }
22047
- async setLockedDuration(frames) {
22048
- const msg = sesame.v1.recorder.RecorderLockedDurationSetRequest.create({ frames });
22049
- await this.rpc.service.requestRecorderOperation({ recorderId: "", setLockedDuration: msg });
22050
- }
22051
- async setMetadata(recorderId, metadata) {
22052
- const msg = sesame.v1.recorder.RecorderMetadataSetRequest.create({ metadata });
22053
- await this.rpc.service.requestRecorderOperation({ recorderId, setMetadata: msg });
22054
- }
22055
- async getClips(recorderId) {
22056
- const msg = sesame.v1.recorder.RecorderClipsGetRequest.create();
22057
- const reply = await this.rpc.service.requestRecorderOperation({ recorderId, getClips: msg });
22058
- if (reply.getClipsResponse && reply.getClipsResponse.clips) {
22059
- return reply.getClipsResponse.clips;
22060
- } else {
22061
- throw new Error(`No clips returned: ${JSON.stringify(reply)}`);
22062
- }
22063
- }
22064
- async getImportClipStatus() {
22065
- const msg = sesame.v1.jobs.ImportListRequest.create();
22066
- return await this.rpc.service.requestClipImportList(msg);
22067
- }
22068
- async getExportPlaylistStatus() {
22069
- const msg = sesame.v1.jobs.ExportListRequest.create();
22070
- return await this.rpc.service.requestPlaylistExportList(msg);
22071
- }
22072
- async exportPlaylist(playlist, config) {
22073
- const msg = sesame.v1.jobs.ExportStartRequest.create();
22074
- if (!config.filename) throw new Error("Filename is required");
22075
- msg.config = {
22076
- ...config,
22077
- filename: config.filename,
22078
- videoCodec: config.videoCodec ?? sesame.v1.common.CodecId.CODEC_ID_H264,
22079
- videoBitrateKbps: config.videoBitrateKbps ?? 1024,
22080
- audioCodec: config.audioCodec ?? sesame.v1.jobs.AudioCodecId.AUDIO_CODEC_ID_AAC,
22081
- audioBitrateKbps: config.audioBitrateKbps ?? 128,
22082
- audioChannels: config.audioChannels ?? 4,
22083
- audioRouting: config.audioRouting ?? [0, 1, 2, 3]
22084
- };
22085
- msg.items = playlist.clips.map((clip) => ({
22086
- id: clip.id,
22087
- recorderId: clip.recorderId,
22088
- transitionTimeUs: clip.transitionTimeUs ?? 0,
22089
- transitionType: clip.transitionType ?? sesame.v1.recorder.TransitionType.TRANSITION_TYPE_MIX,
22090
- transitionFadeColor: clip.transitionFadeColor ?? { x: 0, y: 0, z: 0, w: 0 },
22091
- speed: clip.speed ?? 1,
22092
- audioRouting: clip.audioRouting,
22093
- startTimeUs: clip.startTimeUs,
22094
- endTimeUs: clip.endTimeUs
22095
- }));
22096
- await this.rpc.service.requestPlaylistExportStart(msg);
22097
- }
22098
- async importClip(config) {
22099
- const msg = sesame.v1.jobs.ImportStartRequest.create();
22100
- msg.config = config;
22101
- const res = await this.rpc.service.requestClipImportStart(msg);
22102
- if (res.error) {
22103
- throw new Error(res.error);
22104
- } else {
22105
- return res;
22106
- }
22107
- }
22108
- async abortExportJob(jobId) {
22109
- const msg = { jobId };
22110
- return this.rpc.service.requestPlaylistExportAbort(msg);
22111
- }
22112
- async abortImportJob(jobId) {
22113
- const msg = { jobId };
22114
- return this.rpc.service.requestClipImportAbort(msg);
22115
- }
22116
22143
  disconnect() {
22117
22144
  this.conn.disconnect();
22118
22145
  }
@@ -22128,14 +22155,17 @@ export {
22128
22155
  CommandList,
22129
22156
  EaseKind,
22130
22157
  Event,
22158
+ JobsApi,
22131
22159
  Message,
22132
22160
  PacketType,
22133
22161
  RPCClient,
22162
+ RecorderApi,
22134
22163
  Request,
22135
22164
  Response,
22136
22165
  SesameBinaryProtocol,
22137
22166
  SesameClient,
22138
22167
  SesameConnection,
22168
+ StatusApi,
22139
22169
  getLogger,
22140
22170
  log,
22141
22171
  sesame,