@netless/app-slide 0.2.71-alpha.2 → 0.2.71-alpha.4

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/main.es.js CHANGED
@@ -31503,11 +31503,9 @@ void main(void){
31503
31503
  this.startTimeChangeEmit(), this.emit("play");
31504
31504
  }), this.rctClient.on("resumeAllAudioInterruptByAudioSessionChanged", () => {
31505
31505
  this.emit("resumeAllAudioInterruptByAudioSessionChanged");
31506
- })) : window.__pcmProxy ? (this.domAudio = document.createElement("audio"), this.domAudio.addEventListener("pause", () => {
31506
+ })) : window.__pcmProxy ? (this.domAudio = document.createElement("audio"), this.domAudio.src = t2, this.domAudio.crossOrigin = "anonymous", this.domAudio.addEventListener("pause", () => {
31507
31507
  this.emit("pause");
31508
- }), this.domAudio.addEventListener("playing", () => {
31509
- console.log("connect pcm proxy"), this.pcmSource = window.__pcmProxy.connect(this.domAudio);
31510
- }, { once: true }), this.domAudio.addEventListener("playing", () => {
31508
+ }), this.pcmSource = window.__pcmProxy.connect(this.domAudio), this.domAudio.addEventListener("playing", () => {
31511
31509
  this.emit("load"), this.startTimeChangeEmit(), this.emit("play");
31512
31510
  }), console.log("use pcm proxy")) : (this.howl = new c_.Howl({ src: [t2], html5: null == n2 ? void 0 : n2.enableWebAudio }), [this.staticEventId] = this.howl._getSoundIds(), this.howl.load(), this.howl.on("load", () => {
31513
31511
  this.isHowlLoadEmit = true, this.emit("load");
@@ -31523,15 +31521,15 @@ void main(void){
31523
31521
  }, 300);
31524
31522
  }
31525
31523
  play() {
31526
- var t2, e2, i2;
31527
- this.runningAudio.has(this.url) && (null === (t2 = this.runningAudio.get(this.url)) || void 0 === t2 || t2.stop(), this.runningAudio.delete(this.url)), this.isHowlEnd = false, this.lastTime = -1, null === (e2 = this.howl) || void 0 === e2 || e2.play(this.staticEventId), null === (i2 = this.rctClient) || void 0 === i2 || i2.play(), this.runningAudio.set(this.url, this);
31524
+ var t2, e2, i2, n2;
31525
+ this.runningAudio.has(this.url) && (null === (t2 = this.runningAudio.get(this.url)) || void 0 === t2 || t2.stop(), this.runningAudio.delete(this.url)), this.isHowlEnd = false, this.lastTime = -1, null === (e2 = this.howl) || void 0 === e2 || e2.play(this.staticEventId), null === (i2 = this.rctClient) || void 0 === i2 || i2.play(), null === (n2 = this.domAudio) || void 0 === n2 || n2.play(), this.runningAudio.set(this.url, this);
31528
31526
  }
31529
31527
  fade(t2, e2, i2) {
31530
31528
  this.howl && this.howl.fade(t2, e2, i2);
31531
31529
  }
31532
31530
  pause() {
31533
- var t2, e2;
31534
- null === (t2 = this.howl) || void 0 === t2 || t2.pause(this.staticEventId), null === (e2 = this.rctClient) || void 0 === e2 || e2.pause(), this.runningAudio.has(this.url) && this.runningAudio.delete(this.url);
31531
+ var t2, e2, i2;
31532
+ null === (t2 = this.howl) || void 0 === t2 || t2.pause(this.staticEventId), null === (e2 = this.rctClient) || void 0 === e2 || e2.pause(), null === (i2 = this.domAudio) || void 0 === i2 || i2.pause(), this.runningAudio.has(this.url) && this.runningAudio.delete(this.url);
31535
31533
  }
31536
31534
  globalPause() {
31537
31535
  this.isPaused || (this.isGlobalPause = true, this.pause());
@@ -31540,27 +31538,27 @@ void main(void){
31540
31538
  this.isGlobalPause && (this.isGlobalPause = false, this.play());
31541
31539
  }
31542
31540
  stop() {
31543
- var t2;
31544
- null === (t2 = this.howl) || void 0 === t2 || t2.pause(this.staticEventId), this.rctClient && (this.rctClient.pause(), this.rctClient.currentTime = 0), this.runningAudio.has(this.url) && this.runningAudio.delete(this.url);
31541
+ var t2, e2;
31542
+ null === (t2 = this.howl) || void 0 === t2 || t2.pause(this.staticEventId), null === (e2 = this.domAudio) || void 0 === e2 || e2.pause(), this.rctClient && (this.rctClient.pause(), this.rctClient.currentTime = 0), this.runningAudio.has(this.url) && this.runningAudio.delete(this.url);
31545
31543
  }
31546
31544
  destroy() {
31547
31545
  var t2, e2, i2, n2, r2, o2, s2, a2, l2;
31548
31546
  null === (t2 = this.howl) || void 0 === t2 || t2.stop(this.staticEventId), null === (e2 = this.howl) || void 0 === e2 || e2.unload(), null === (i2 = this.rctClient) || void 0 === i2 || i2.pause(), null === (n2 = this.rctClient) || void 0 === n2 || n2.destroy(), null === (r2 = this.rctClient) || void 0 === r2 || r2.removeAllListeners("load"), null === (o2 = this.rctClient) || void 0 === o2 || o2.removeAllListeners("play"), null === (s2 = this.rctClient) || void 0 === s2 || s2.removeAllListeners("pause"), null === (a2 = this.rctClient) || void 0 === a2 || a2.removeAllListeners("resumeAllAudioInterruptByAudioSessionChanged"), null === (l2 = this.pcmSource) || void 0 === l2 || l2.disconnect(), this.runningAudio.has(this.url) && this.runningAudio.delete(this.url);
31549
31547
  }
31550
31548
  get currentTime() {
31551
- return this.rctClient ? this.rctClient.currentTime : this.howl ? this.howl.seek(this.staticEventId) : -1;
31549
+ return this.rctClient ? this.rctClient.currentTime : this.howl ? this.howl.seek(this.staticEventId) : this.domAudio ? this.domAudio.currentTime : -1;
31552
31550
  }
31553
31551
  set currentTime(t2) {
31554
- this.rctClient ? this.rctClient.currentTime = t2 : this.howl && this.howl.seek(t2, this.staticEventId);
31552
+ this.rctClient ? this.rctClient.currentTime = t2 : this.howl ? this.howl.seek(t2, this.staticEventId) : this.domAudio && (this.domAudio.currentTime = t2);
31555
31553
  }
31556
31554
  get duration() {
31557
- return this.rctClient ? this.rctClient.duration : this.howl ? this.howl.duration(this.staticEventId) : 0;
31555
+ return this.rctClient ? this.rctClient.duration : this.howl ? this.howl.duration(this.staticEventId) : this.domAudio ? this.domAudio.duration : 0;
31558
31556
  }
31559
31557
  get isPaused() {
31560
- return this.rctClient ? this.rctClient.isPaused : !!this.howl && !this.howl.playing(this.staticEventId);
31558
+ return this.rctClient ? this.rctClient.isPaused : this.howl ? !this.howl.playing(this.staticEventId) : !!this.domAudio && this.domAudio.paused;
31561
31559
  }
31562
31560
  volume(t2) {
31563
- this.rctClient ? this.rctClient.volume(t2) : this.howl && this.howl.volume(t2);
31561
+ this.rctClient ? this.rctClient.volume(t2) : this.howl ? this.howl.volume(t2) : this.domAudio && (this.domAudio.volume = t2);
31564
31562
  }
31565
31563
  }
31566
31564
  var p_ = function(t2, e2, i2, n2) {
@@ -31611,7 +31609,7 @@ void main(void){
31611
31609
  return this.controller.clippedDuration;
31612
31610
  }
31613
31611
  constructor(t2) {
31614
- var e2, i2, n2, r2, o2, s2, a2, l2;
31612
+ var e2, i2, n2, r2, o2, s2, a2;
31615
31613
  super(), this.type = "video", this.sprite = new ep(), this.rtcAudio = null, this.pcmSource = null, this.isPlaying = false, this.isGlobalPause = false, this.fullscreen = false, this.url = "", this.isLoaded = false, this.onVideoResourceLoaded = () => {
31616
31614
  this.isLoaded = true;
31617
31615
  }, this.onVideoStalled = () => {
@@ -31623,12 +31621,10 @@ void main(void){
31623
31621
  const { targetId: e3, state: i3, slideIndex: n3 } = t3;
31624
31622
  n3 === this.ctx.slideIndex && e3 === this.id && (i3 ? (this.requestFullscreen(), this.ctx.latestChangeFullscreenTargetId = e3) : this.requestCancelFullscreen());
31625
31623
  }, this.id = t2.id, this.start = null === (e2 = t2.video.cut) || void 0 === e2 ? void 0 : e2.start, this.end = null === (i2 = t2.video.cut) || void 0 === i2 ? void 0 : i2.end, this.fullscreen = null !== (n2 = t2.video.fullscreen) && void 0 !== n2 && n2, this.container = t2.container, this.ctx = t2.ctx, this.ctx.medias[this.id] = this;
31626
- const h2 = t2.video.src;
31627
- this.videoResource = new Vh.w(h2, { autoLoad: true, autoPlay: false, updateFPS: 30, crossorigin: true }), null === (r2 = this.videoElement) || void 0 === r2 || r2.addEventListener("stalled", this.onVideoStalled), null === (o2 = this.videoElement) || void 0 === o2 || o2.addEventListener("loadedmetadata", this.onVideoResourceLoaded), this.url = t2.video.src;
31628
- let u2 = t2.video.src.replace(/4$/, "3");
31629
- this.ctx.loaderDelegate && (u2 = this.ctx.loaderDelegate.redirectMedia(u2), this.ctx.logger.info(`redirect media url from ${t2.video.src.replace(/4$/, "3")} to ${u2} by delegate.`, t2.ctx.taskId)), window.__pcmProxy ? null === (s2 = this.videoElement) || void 0 === s2 || s2.addEventListener("playing", () => {
31630
- console.log("use pcm proxy"), this.pcmSource = window.__pcmProxy.connect(this.videoElement);
31631
- }, { once: true }) : (this.rtcAudio = new d_(u2, t2.ctx.runningAudio, { start: null === (a2 = t2.video.cut) || void 0 === a2 ? void 0 : a2.start, end: null === (l2 = t2.video.cut) || void 0 === l2 ? void 0 : l2.end }, { enableWebAudio: t2.ctx.enableWebAudio }), this.rtcAudio.on("timeupdate", (t3) => {
31624
+ const l2 = t2.video.src;
31625
+ this.videoResource = new Vh.w(l2, { autoLoad: true, autoPlay: false, updateFPS: 30, crossorigin: true }), null === (r2 = this.videoElement) || void 0 === r2 || r2.addEventListener("stalled", this.onVideoStalled), null === (o2 = this.videoElement) || void 0 === o2 || o2.addEventListener("loadedmetadata", this.onVideoResourceLoaded), this.url = t2.video.src;
31626
+ let h2 = t2.video.src.replace(/4$/, "3");
31627
+ this.ctx.loaderDelegate && (h2 = this.ctx.loaderDelegate.redirectMedia(h2), this.ctx.logger.info(`redirect media url from ${t2.video.src.replace(/4$/, "3")} to ${h2} by delegate.`, t2.ctx.taskId)), window.__pcmProxy ? this.videoElement && (this.videoElement.crossOrigin = "anonymous", console.log("connect pcm proxy"), this.pcmSource = window.__pcmProxy.connect(this.videoElement)) : (this.rtcAudio = new d_(h2, t2.ctx.runningAudio, { start: null === (s2 = t2.video.cut) || void 0 === s2 ? void 0 : s2.start, end: null === (a2 = t2.video.cut) || void 0 === a2 ? void 0 : a2.end }, { enableWebAudio: t2.ctx.enableWebAudio }), this.rtcAudio.on("timeupdate", (t3) => {
31632
31628
  if (this.videoElement) {
31633
31629
  const e3 = this.videoElement.currentTime;
31634
31630
  Math.abs(e3 - t3) > 0.5 && (this.videoElement.currentTime = t3);
@@ -31640,14 +31636,14 @@ void main(void){
31640
31636
  (null === (t4 = this.rtcAudio) || void 0 === t4 ? void 0 : t4.isPaused) || null === (e3 = this.videoElement) || void 0 === e3 || e3.play();
31641
31637
  }, 200);
31642
31638
  }));
31643
- const { video: c2, width: d2, height: p2, target: f2 } = t2;
31644
- this.controller = new u_({ targetId: t2.id, shapeId: t2.shapeId, ctx: t2.ctx, width: d2, height: p2, target: f2, media: this, info: c2, canvasElement: t2.canvasElement }), this.controller.addPlayCallBack(() => {
31645
- this.sprite.width = d2, this.sprite.height = p2, this.ctx.clock.setTimeout(() => {
31639
+ const { video: u2, width: c2, height: d2, target: p2 } = t2;
31640
+ this.controller = new u_({ targetId: t2.id, shapeId: t2.shapeId, ctx: t2.ctx, width: c2, height: d2, target: p2, media: this, info: u2, canvasElement: t2.canvasElement }), this.controller.addPlayCallBack(() => {
31641
+ this.sprite.width = c2, this.sprite.height = d2, this.ctx.clock.setTimeout(() => {
31646
31642
  this.sprite.visible = true;
31647
31643
  }, 50);
31648
31644
  });
31649
- const m2 = new Vh.c(null, { height: p2, width: d2 });
31650
- m2.resource = this.videoResource, this.videoResource.bind(m2), this.sprite = new ep(), this.sprite.visible = false, this.sprite.texture = new Vh.t(m2), this.sprite.interactive = true, this.container.addChild(this.sprite), this.sprite.on("mouseover", (t3) => {
31645
+ const f2 = new Vh.c(null, { height: d2, width: c2 });
31646
+ f2.resource = this.videoResource, this.videoResource.bind(f2), this.sprite = new ep(), this.sprite.visible = false, this.sprite.texture = new Vh.t(f2), this.sprite.interactive = true, this.container.addChild(this.sprite), this.sprite.on("mouseover", (t3) => {
31651
31647
  t3.stopPropagation(), this.controller.show();
31652
31648
  }), this.sprite.on("mouseout", (t3) => {
31653
31649
  t3.stopPropagation(), this.controller.hide();
@@ -36216,9 +36212,9 @@ void main(void){
36216
36212
  }
36217
36213
  var vT = { syncDispatch: "syncDispatch", syncReceive: "syncReceive", syncEventLag: "syncEventLag", renderStart: "renderStart", renderEnd: "renderEnd", renderError: "renderError", slideChange: "slideChange", mainSeqStepStart: "mainSeqStepStart", mainSeqStepEnd: "mainSeqStepEnd", animateStart: "animateStart", animateEnd: "animateEnd", stateChange: "stateChange", slideStepEnd: "slideEnd", slideStepStart: "slideStart" }, _T = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, yT = "";
36218
36214
  try {
36219
- yT = "1.4.31-alpha.0";
36215
+ yT = "1.4.31-alpha.1";
36220
36216
  } catch (t2) {
36221
- yT = "-dev-";
36217
+ yT = "-dev";
36222
36218
  }
36223
36219
  var xT = null;
36224
36220
  try {
@@ -39505,7 +39501,7 @@ class SlidePreviewer {
39505
39501
  }
39506
39502
  }
39507
39503
  const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
39508
- const version = "0.2.71-alpha.2";
39504
+ const version = "0.2.71-alpha.4";
39509
39505
  const SlideApp = {
39510
39506
  kind: "Slide",
39511
39507
  setup(context) {