@netless/app-slide 0.2.47-alpha.5 → 0.2.47-alpha.6

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
@@ -23108,8 +23108,7 @@ var Slide = function(t) {
23108
23108
  return t2;
23109
23109
  }
23110
23110
  applyOptions(t2) {
23111
- var e2, i2;
23112
- super.applyOptions(t2), this.material.uniforms.direction = { value: ((i2 = (e2 = this.options) === null || e2 === void 0 ? void 0 : e2[0]) === null || i2 === void 0 ? void 0 : i2.value) === "horz" ? 0 : 1 };
23111
+ super.applyOptions(t2), this.material.uniforms.direction = { value: this.options[0].value === "horz" ? 1 : 0 };
23113
23112
  }
23114
23113
  setSize(t2, e2) {
23115
23114
  super.setSize(t2, e2), this.material.uniforms.lines = { value: this.genRandomLines() }, this.material.vertexShader = ol.a;
@@ -23123,10 +23122,10 @@ var Slide = function(t) {
23123
23122
  super(...arguments), this.duration = 1400, this.fragmentShader = cl.a, this.options = [{ name: "dir", value: "center" }], this.optionsMap = { center: 0, ru: 1, lu: 2, ld: 3, rd: 4 };
23124
23123
  }
23125
23124
  applyOptions(t2) {
23126
- var e2, i2;
23125
+ var e2, i2, n2, r2;
23127
23126
  super.applyOptions(t2);
23128
- const n2 = this.options.find((t3) => t3.name === "dir");
23129
- this.material.uniforms.option = { value: (e2 = this.optionsMap) === null || e2 === void 0 ? void 0 : e2[(i2 = n2 == null ? void 0 : n2.value) !== null && i2 !== void 0 ? i2 : "center"] };
23127
+ const o2 = this.options.find((t3) => t3.name === "dir");
23128
+ console.log((e2 = this.optionsMap) === null || e2 === void 0 ? void 0 : e2[(i2 = o2 == null ? void 0 : o2.value) !== null && i2 !== void 0 ? i2 : "center"]), this.material.uniforms.option = { value: (n2 = this.optionsMap) === null || n2 === void 0 ? void 0 : n2[(r2 = o2 == null ? void 0 : o2.value) !== null && r2 !== void 0 ? r2 : "center"] };
23130
23129
  }
23131
23130
  }, Erase: class extends nl {
23132
23131
  constructor() {
@@ -31224,7 +31223,7 @@ void main(void){
31224
31223
  t3.stopPropagation(), this.hide();
31225
31224
  }, this.mediaTimeUpdate = () => r_(this, void 0, void 0, function* () {
31226
31225
  const t3 = this.media.currentTime - this.start;
31227
- if ((this.duration > 0 && Math.abs(t3 - this.duration) < 0.3 || t3 > this.duration) && (yield this.pauseMedia(), this.medianIsEnd = true, this.jumpToTime(), this.ctx.eventHub.emit(jy.mediaStop, { id: this.targetId }), this.onClickCancelFullScreenButtonHandle()), this.currentTime.innerText = a_.formatTime(t3), this.currentProgress.style.flex = (t3 / this.duration).toString(), this.bookmarkList && this.bookmarkList.length > 0) {
31226
+ if (this.duration > 0 && (Math.abs(t3 - this.duration) < 0.3 || t3 > this.duration) && (yield this.pauseMedia(), this.medianIsEnd = true, this.jumpToTime(), this.ctx.eventHub.emit(jy.mediaStop, { id: this.targetId }), this.onClickCancelFullScreenButtonHandle()), this.currentTime.innerText = a_.formatTime(t3), this.currentProgress.style.flex = (t3 / this.duration).toString(), this.bookmarkList && this.bookmarkList.length > 0) {
31228
31227
  const t4 = this.bookmarkList[this.pickBookmarkIndex];
31229
31228
  t4 && t4.time.toFixed(0) === this.media.currentTime.toFixed(0) && (this.ctx.timingEventHub.emit(`shape ${this.shapeId} onMediaBookmark ${t4.name}`), this.pickBookmarkIndex += 1);
31230
31229
  }
@@ -31234,7 +31233,7 @@ void main(void){
31234
31233
  }, this.onPlayMedia = () => {
31235
31234
  this.fadeState = { in: false, out: false }, this.fadeHit(0), this.playButton.style.display = "none", this.pauseButton.style.display = "block", this.playCallBackList.forEach((t3) => {
31236
31235
  t3();
31237
- });
31236
+ }), this.media.currentTime < this.start && this.jumpToTime();
31238
31237
  }, this._playMediaFromCtrl = () => {
31239
31238
  this.playMediaFromCtrl(false);
31240
31239
  }, this._pauseMediaFromCtrl = () => {
@@ -31403,13 +31402,16 @@ void main(void){
31403
31402
  }
31404
31403
  var l_ = i(120);
31405
31404
  class h_ extends Za.a {
31406
- constructor(t2, e2) {
31407
- super(), this.isGlobalPause = false, this.lastTime = -1, this.howl = null, this.rctClient = null, this.isHowlEnd = false, this.isHowlLoadEmit = false, this.staticEventId = 1001, this.url = t2, this.runningAudio = e2, zy.RtcAudioClazz ? (this.rctClient = new zy.RtcAudioClazz(t2), this.rctClient.on("load", () => this.emit("load")), this.rctClient.on("pause", () => this.emit("pause")), this.rctClient.on("play", () => this.emit("play")), this.rctClient.on("resumeAllAudioInterruptByAudioSessionChanged", () => {
31405
+ constructor(t2, e2, i2) {
31406
+ var n2, r2;
31407
+ super(), this.isGlobalPause = false, this.lastTime = -1, this.howl = null, this.rctClient = null, this.isHowlEnd = false, this.isHowlLoadEmit = false, this.staticEventId = 1001, this._catParams = void 0, this.url = t2, this.runningAudio = e2, i2 && (this._catParams = i2), zy.RtcAudioClazz ? (this.rctClient = new zy.RtcAudioClazz(t2, (n2 = this._catParams) === null || n2 === void 0 ? void 0 : n2.start, (r2 = this._catParams) === null || r2 === void 0 ? void 0 : r2.end), console.log("rctClient", this.rctClient), this.rctClient.on("load", () => this.emit("load")), this.rctClient.on("pause", () => this.emit("pause")), this.rctClient.on("play", () => {
31408
+ this.startTimeChangeEmit(), this.emit("play");
31409
+ }), this.rctClient.on("resumeAllAudioInterruptByAudioSessionChanged", () => {
31408
31410
  this.emit("resumeAllAudioInterruptByAudioSessionChanged");
31409
31411
  })) : (this.howl = new l_.Howl({ src: [t2] }), [this.staticEventId] = this.howl._getSoundIds(), this.howl.load(), this.howl.on("load", () => {
31410
31412
  this.isHowlLoadEmit = true, this.emit("load");
31411
31413
  }), this.howl.on("pause", () => this.emit("pause")), this.howl.on("play", () => {
31412
- this.isHowlLoadEmit || this.emit("load"), this.isHowlEnd = false, this.emit("play");
31414
+ this.isHowlLoadEmit || this.emit("load"), this.isHowlEnd = false, this.startTimeChangeEmit(), this.emit("play");
31413
31415
  }), this.howl.on("end", () => {
31414
31416
  this.isHowlEnd = true;
31415
31417
  }));
@@ -31421,7 +31423,7 @@ void main(void){
31421
31423
  }
31422
31424
  play() {
31423
31425
  var t2, e2, i2;
31424
- this.runningAudio.has(this.url) && ((t2 = this.runningAudio.get(this.url)) === null || t2 === void 0 || t2.stop(), this.runningAudio.delete(this.url)), this.isHowlEnd = false, this.lastTime = -1, (e2 = this.howl) === null || e2 === void 0 || e2.play(this.staticEventId), (i2 = this.rctClient) === null || i2 === void 0 || i2.play(), this.startTimeChangeEmit(), this.runningAudio.set(this.url, this);
31426
+ this.runningAudio.has(this.url) && ((t2 = this.runningAudio.get(this.url)) === null || t2 === void 0 || t2.stop(), this.runningAudio.delete(this.url)), this.isHowlEnd = false, this.lastTime = -1, (e2 = this.howl) === null || e2 === void 0 || e2.play(this.staticEventId), (i2 = this.rctClient) === null || i2 === void 0 || i2.play(), this.runningAudio.set(this.url, this);
31425
31427
  }
31426
31428
  fade(t2, e2, i2) {
31427
31429
  this.howl && this.howl.fade(t2, e2, i2);
@@ -31438,7 +31440,10 @@ void main(void){
31438
31440
  }
31439
31441
  stop() {
31440
31442
  var t2;
31441
- (t2 = this.howl) === null || t2 === void 0 || t2.pause(this.staticEventId), this.rctClient && (this.rctClient.pause(), this.rctClient.currentTime = 0), this.runningAudio.has(this.url) && this.runningAudio.delete(this.url);
31443
+ (t2 = this.howl) === null || t2 === void 0 || t2.pause(this.staticEventId), this.rctClient && (this.rctClient.pause(), this.rctClient.currentTime = 0, setTimeout(() => {
31444
+ var t3;
31445
+ console.log("current time: " + ((t3 = this.rctClient) === null || t3 === void 0 ? void 0 : t3.currentTime));
31446
+ })), this.runningAudio.has(this.url) && this.runningAudio.delete(this.url);
31442
31447
  }
31443
31448
  destroy() {
31444
31449
  var t2, e2, i2, n2, r2, o2, s2, a2;
@@ -31487,7 +31492,7 @@ void main(void){
31487
31492
  };
31488
31493
  class c_ extends Za.a {
31489
31494
  constructor(t2) {
31490
- var e2, i2, n2, r2, o2;
31495
+ var e2, i2, n2, r2, o2, s2, a2;
31491
31496
  super(), this.type = "video", this.sprite = new ep(), this.isPlaying = false, this.isGlobalPause = false, this.fullscreen = false, this.url = "", this.isLoaded = false, this.onVideoResourceLoaded = () => {
31492
31497
  this.isLoaded = true;
31493
31498
  }, this.onVideoStalled = () => {
@@ -31498,10 +31503,10 @@ void main(void){
31498
31503
  const { targetId: e3, state: i3, slideIndex: n3 } = t3;
31499
31504
  n3 === this.ctx.slideIndex && e3 === this.id && (i3 ? (this.requestFullscreen(), this.ctx.latestChangeFullscreenTargetId = e3) : this.requestCancelFullscreen());
31500
31505
  }, this.id = t2.id, this.start = (e2 = t2.video.cut) === null || e2 === void 0 ? void 0 : e2.start, this.end = (i2 = t2.video.cut) === null || i2 === void 0 ? void 0 : i2.end, this.fullscreen = (n2 = t2.video.fullscreen) !== null && n2 !== void 0 && n2, this.container = t2.container, this.ctx = t2.ctx, this.ctx.medias[this.id] = this;
31501
- const s2 = t2.video.src;
31502
- this.videoResource = new Vh.w(s2, { autoLoad: true, autoPlay: false, updateFPS: 30, crossorigin: true }), (r2 = this.videoElement) === null || r2 === void 0 || r2.addEventListener("stalled", this.onVideoStalled), (o2 = this.videoElement) === null || o2 === void 0 || o2.addEventListener("loadedmetadata", this.onVideoResourceLoaded), this.url = t2.video.src;
31503
- let a2 = t2.video.src.replace(/4$/, "3");
31504
- this.ctx.loaderDelegate && (a2 = this.ctx.loaderDelegate.redirectMedia(a2), this.ctx.logger.info(`redirect media url from ${t2.video.src.replace(/4$/, "3")} to ${a2} by delegate.`, t2.ctx.taskId)), this.rtcAudio = new h_(a2, t2.ctx.runningAudio), this.rtcAudio.on("timeupdate", (t3) => {
31506
+ const l2 = t2.video.src;
31507
+ this.videoResource = new Vh.w(l2, { autoLoad: true, autoPlay: false, updateFPS: 30, crossorigin: true }), (r2 = this.videoElement) === null || r2 === void 0 || r2.addEventListener("stalled", this.onVideoStalled), (o2 = this.videoElement) === null || o2 === void 0 || o2.addEventListener("loadedmetadata", this.onVideoResourceLoaded), this.url = t2.video.src;
31508
+ let h2 = t2.video.src.replace(/4$/, "3");
31509
+ 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)), this.rtcAudio = new h_(h2, t2.ctx.runningAudio, { start: (s2 = t2.video.cut) === null || s2 === void 0 ? void 0 : s2.start, end: (a2 = t2.video.cut) === null || a2 === void 0 ? void 0 : a2.end }), this.rtcAudio.on("timeupdate", (t3) => {
31505
31510
  if (this.videoElement) {
31506
31511
  const e3 = this.videoElement.currentTime;
31507
31512
  Math.abs(e3 - t3) > 0.5 && this.videoElement.fastSeek(t3);
@@ -31513,14 +31518,14 @@ void main(void){
31513
31518
  this.rtcAudio.isPaused || (t4 = this.videoElement) === null || t4 === void 0 || t4.play();
31514
31519
  }, 200);
31515
31520
  });
31516
- const { video: l2, width: h2, height: u2, target: c2 } = t2;
31517
- this.controller = new a_({ targetId: t2.id, shapeId: t2.shapeId, ctx: t2.ctx, width: h2, height: u2, target: c2, media: this, info: l2, canvasElement: t2.canvasElement }), this.controller.addPlayCallBack(() => {
31518
- this.sprite.width = h2, this.sprite.height = u2, this.ctx.clock.setTimeout(() => {
31521
+ const { video: u2, width: c2, height: d2, target: p2 } = t2;
31522
+ this.controller = new a_({ 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(() => {
31523
+ this.sprite.width = c2, this.sprite.height = d2, this.ctx.clock.setTimeout(() => {
31519
31524
  this.sprite.visible = true;
31520
31525
  }, 50);
31521
31526
  });
31522
- const d2 = new Vh.c(null, { height: u2, width: h2 });
31523
- d2.resource = this.videoResource, this.videoResource.bind(d2), this.sprite = new ep(), this.sprite.visible = false, this.sprite.texture = new Vh.t(d2), this.sprite.interactive = true, this.container.addChild(this.sprite), this.sprite.on("mouseover", (t3) => {
31527
+ const f2 = new Vh.c(null, { height: d2, width: c2 });
31528
+ 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) => {
31524
31529
  t3.stopPropagation(), this.controller.show();
31525
31530
  }), this.sprite.on("mouseout", (t3) => {
31526
31531
  t3.stopPropagation(), this.controller.hide();
@@ -31643,13 +31648,14 @@ void main(void){
31643
31648
  };
31644
31649
  class p_ extends Za.a {
31645
31650
  constructor(t2) {
31651
+ var e2, i2;
31646
31652
  super(), this.type = "audio", this.isPlaying = false, this.isGlobalPause = false, this.updateVolume = (t3) => {
31647
31653
  this.audioPlayer.volume(t3);
31648
31654
  }, this.id = t2.id;
31649
- const e2 = t2.audio.src;
31650
- this.audioPlayer = new h_(e2, t2.ctx.runningAudio), t2.audio.cut && (this.start = t2.audio.cut.start, this.end = t2.audio.cut.end), this.ctx = t2.ctx, this.ctx.medias[this.id] = this;
31651
- const { width: i2, height: n2, target: r2 } = t2;
31652
- this.controller = new a_({ targetId: t2.id, shapeId: t2.shapeId, ctx: t2.ctx, height: n2, width: i2, target: r2, media: this, info: t2.audio, canvasElement: t2.canvasElement }), this.audioPlayer.on("load", () => this.emit("durationchange")), this.audioPlayer.on("timeupdate", () => this.emit("timeupdate")), this.audioPlayer.on("pause", () => this.emit("pause")), this.audioPlayer.on("play", () => this.emit("play")), this.ctx.activeMedia.add(this), this.ctx.volumeAdjuster.on("update", this.updateVolume);
31655
+ const n2 = t2.audio.src;
31656
+ this.audioPlayer = new h_(n2, t2.ctx.runningAudio, { start: (e2 = t2.audio.cut) === null || e2 === void 0 ? void 0 : e2.start, end: (i2 = t2.audio.cut) === null || i2 === void 0 ? void 0 : i2.end }), t2.audio.cut && (this.start = t2.audio.cut.start, this.end = t2.audio.cut.end), this.ctx = t2.ctx, this.ctx.medias[this.id] = this;
31657
+ const { width: r2, height: o2, target: s2 } = t2;
31658
+ this.controller = new a_({ targetId: t2.id, shapeId: t2.shapeId, ctx: t2.ctx, height: o2, width: r2, target: s2, media: this, info: t2.audio, canvasElement: t2.canvasElement }), this.audioPlayer.on("load", () => this.emit("durationchange")), this.audioPlayer.on("timeupdate", () => this.emit("timeupdate")), this.audioPlayer.on("pause", () => this.emit("pause")), this.audioPlayer.on("play", () => this.emit("play")), this.ctx.activeMedia.add(this), this.ctx.volumeAdjuster.on("update", this.updateVolume);
31653
31659
  }
31654
31660
  get currentTime() {
31655
31661
  return this.audioPlayer.currentTime;
@@ -35970,7 +35976,7 @@ void main(void){
35970
35976
  }
35971
35977
  var pT = { 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" }, fT = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, mT = "";
35972
35978
  try {
35973
- mT = "1.1.9-beta.1";
35979
+ mT = "1.1.9-beta.3";
35974
35980
  } catch (t2) {
35975
35981
  mT = "dev -";
35976
35982
  }
@@ -39092,7 +39098,7 @@ class SlidePreviewer {
39092
39098
  }
39093
39099
  }
39094
39100
  const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
39095
- const version = "0.2.47-alpha.5";
39101
+ const version = "0.2.47-alpha.6";
39096
39102
  const SlideApp = {
39097
39103
  kind: "Slide",
39098
39104
  setup(context) {