@netless/app-slide 0.2.28 → 0.2.29-beta.1

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
@@ -30411,7 +30411,6 @@ void main() {
30411
30411
  constructor(t2, e2) {
30412
30412
  var i2;
30413
30413
  super(void 0, (i2 = rv[t2], `
30414
-
30415
30414
  varying vec2 vTextureCoord;
30416
30415
 
30417
30416
  uniform float arg;
@@ -30433,7 +30432,6 @@ void main(void){
30433
30432
  constructor(t2, e2, i2) {
30434
30433
  var n2;
30435
30434
  super(void 0, (n2 = av[t2], `
30436
-
30437
30435
  varying vec2 vTextureCoord;
30438
30436
 
30439
30437
  uniform vec4 arg1;
@@ -30451,12 +30449,11 @@ void main(void){
30451
30449
  `), { arg1: Float32Array.from(e2), arg2: Float32Array.from(i2) });
30452
30450
  }
30453
30451
  }
30454
- const hv = [iv], uv = { lum: "\nvec4 transform(vec4 texColor, float arg1, float arg2) {\n vec3 rgb = texColor.rgb / texColor.a;\n\n // \u5BF9\u6BD4\u5EA6\n float C = arg2 * 255.0;\n float F = (259.0 * (255.0 + C)) / (255.0 * (259.0 - C));\n rgb.rgb = F * (rgb.rgb - 0.5) + 0.5;\n\n // \u4EAE\u5EA6\n rgb.rgb += arg1;\n\n rgb.rgb *= texColor.a;\n return vec4(rgb, texColor.a);\n}\n" };
30452
+ const hv = [iv], uv = { lum: "\nvec4 transform(vec4 texColor, float arg1, float arg2) {\n vec3 rgb = texColor.rgb / texColor.a;\n\n // \u5BF9\u6BD4\u5EA6\n highp float C = arg2 * 255.0;\n highp float F = (259.0 * (255.0 + C)) / (255.0 * (259.0 - C));\n rgb.rgb = F * (rgb.rgb - 0.5) + 0.5;\n\n // \u4EAE\u5EA6\n rgb.rgb += arg1;\n\n rgb.rgb *= texColor.a;\n return vec4(rgb, texColor.a);\n}\n" };
30455
30453
  class cv extends Wh.u {
30456
30454
  constructor(t2, e2, i2) {
30457
30455
  var n2;
30458
30456
  super(void 0, (n2 = uv[t2], `
30459
-
30460
30457
  varying vec2 vTextureCoord;
30461
30458
 
30462
30459
  uniform float arg1;
@@ -30479,7 +30476,6 @@ void main(void){
30479
30476
  constructor(t2, e2) {
30480
30477
  var i2;
30481
30478
  super(void 0, (i2 = pv[t2], `
30482
-
30483
30479
  varying vec2 vTextureCoord;
30484
30480
 
30485
30481
  uniform vec4 arg1;
@@ -31900,54 +31896,64 @@ void main(void){
31900
31896
  };
31901
31897
  class d_ extends Ja.a {
31902
31898
  constructor(t2) {
31903
- var e2, i2, n2;
31899
+ var e2, i2, n2, r2, o2, s2, a2;
31904
31900
  super(), this.type = "video", this.sprite = new op(), this.isPlaying = false, this.isGlobalPause = false, this.fullscreen = false, this.url = "", this.onVideoStalled = () => {
31905
31901
  this.ctx.logger.warn(this.url + ", Failed to fetch data, but trying.", this.ctx.taskId);
31906
31902
  }, this.updateVolume = (t3) => {
31907
- qy.RtcAudioClazz ? this.rtcAudio.volume(t3) : this.videoResource.source && (this.videoResource.source.volume = t3);
31903
+ qy.RtcAudioClazz ? this.rtcAudio.volume(t3) : this.videoElement && (this.videoElement.volume = t3);
31908
31904
  }, this.syncFullscreenVideoState = (t3) => {
31909
31905
  const { targetId: e3, state: i3, slideIndex: n3 } = t3;
31910
31906
  n3 === this.ctx.slideIndex && e3 === this.id && (i3 ? this.requestFullscreen() : this.requestCancelFullscreen());
31911
31907
  }, 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;
31912
- let r2 = t2.video.src;
31913
- this.ctx.loaderDelegate && (r2 = this.ctx.loaderDelegate.redirectMedia(r2), this.ctx.logger.info(`redirect media url from ${t2.video.src} to ${r2} by delegate.`, t2.ctx.taskId)), this.videoResource = new Wh.jb(r2, { autoLoad: true, autoPlay: false, updateFPS: 30, crossorigin: true }), this.videoResource.source.addEventListener("stalled", this.onVideoStalled), this.url = t2.video.src;
31914
- let o2 = t2.video.src.replace(/4$/, "3");
31915
- this.ctx.loaderDelegate && (o2 = this.ctx.loaderDelegate.redirectMedia(o2), this.ctx.logger.info(`redirect media url from ${t2.video.src.replace(/4$/, "3")} to ${o2} by delegate.`, t2.ctx.taskId)), this.rtcAudio = new u_(o2, t2.ctx.runningAudio);
31916
- const { video: s2, width: a2, height: l2, target: h2 } = t2;
31917
- this.controller = new l_({ targetId: t2.id, shapeId: t2.shapeId, ctx: t2.ctx, width: a2, height: l2, target: h2, media: this, info: s2, canvasElement: t2.canvasElement }), this.controller.addPlayCallBack(() => {
31918
- this.sprite.width = a2, this.sprite.height = l2, this.ctx.clock.setTimeout(() => {
31908
+ let l2 = t2.video.src;
31909
+ this.ctx.loaderDelegate && (l2 = this.ctx.loaderDelegate.redirectMedia(l2), this.ctx.logger.info(`redirect media url from ${t2.video.src} to ${l2} by delegate.`, t2.ctx.taskId)), this.videoResource = new Wh.jb(l2, { autoLoad: true, autoPlay: false, updateFPS: 30, crossorigin: true }), (r2 = this.videoElement) === null || r2 === void 0 || r2.addEventListener("stalled", this.onVideoStalled), this.url = t2.video.src;
31910
+ let h2 = t2.video.src.replace(/4$/, "3");
31911
+ 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 u_(h2, t2.ctx.runningAudio);
31912
+ const { video: u2, width: c2, height: d2, target: p2 } = t2;
31913
+ this.controller = new l_({ 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(() => {
31914
+ this.sprite.width = c2, this.sprite.height = d2, this.ctx.clock.setTimeout(() => {
31919
31915
  this.sprite.visible = true;
31920
31916
  }, 50);
31921
31917
  });
31922
- const u2 = new Wh.h(null, { height: l2, width: a2 });
31923
- u2.resource = this.videoResource, this.videoResource.bind(u2), this.sprite = new op(), this.sprite.visible = false, this.sprite.texture = new Wh.db(u2), this.sprite.interactive = true, this.container.addChild(this.sprite), this.sprite.on("mouseover", (t3) => {
31918
+ const f2 = new Wh.h(null, { height: d2, width: c2 });
31919
+ f2.resource = this.videoResource, this.videoResource.bind(f2), this.sprite = new op(), this.sprite.visible = false, this.sprite.texture = new Wh.db(f2), this.sprite.interactive = true, this.container.addChild(this.sprite), this.sprite.on("mouseover", (t3) => {
31924
31920
  t3.stopPropagation(), this.controller.show();
31925
31921
  }), this.sprite.on("mouseout", (t3) => {
31926
31922
  t3.stopPropagation(), this.controller.hide();
31927
31923
  }), ["durationchange", "timeupdate", "pause", "play"].forEach((t3) => {
31928
- this.videoResource.source.addEventListener(t3, () => {
31924
+ var e3;
31925
+ (e3 = this.videoElement) === null || e3 === void 0 || e3.addEventListener(t3, () => {
31929
31926
  t3 === "timeupdate" && this.isPlaying, this.emit(t3);
31930
31927
  });
31928
+ }), (o2 = this.videoElement) === null || o2 === void 0 || o2.addEventListener("playing", () => {
31929
+ this.rtcAudio.play();
31930
+ }), (s2 = this.videoElement) === null || s2 === void 0 || s2.addEventListener("pause", () => {
31931
+ console.log("video pause");
31932
+ }), (a2 = this.videoElement) === null || a2 === void 0 || a2.addEventListener("stalled", () => {
31933
+ console.log("video stalled");
31931
31934
  }), this.ctx.activeMedia.add(this), this.ctx.volumeAdjuster.on("update", this.updateVolume), this.ctx.globalEventHub.on("syncFullscreenVideoState", this.syncFullscreenVideoState);
31932
31935
  }
31936
+ get videoElement() {
31937
+ return this.videoResource.source;
31938
+ }
31933
31939
  get currentTime() {
31934
31940
  var t2, e2;
31935
- return (e2 = (t2 = this.videoResource.source) === null || t2 === void 0 ? void 0 : t2.currentTime) !== null && e2 !== void 0 ? e2 : 0;
31941
+ return (e2 = (t2 = this.videoElement) === null || t2 === void 0 ? void 0 : t2.currentTime) !== null && e2 !== void 0 ? e2 : 0;
31936
31942
  }
31937
31943
  set currentTime(t2) {
31938
- qy.RtcAudioClazz && (this.rtcAudio.currentTime = t2), this.videoResource.source && (this.videoResource.source.currentTime = t2);
31944
+ qy.RtcAudioClazz && (this.rtcAudio.currentTime = t2), this.videoElement && (this.videoElement.currentTime = t2);
31939
31945
  }
31940
31946
  get paused() {
31941
31947
  var t2, e2;
31942
- return (e2 = (t2 = this.videoResource.source) === null || t2 === void 0 ? void 0 : t2.paused) === null || e2 === void 0 || e2;
31948
+ return (e2 = (t2 = this.videoElement) === null || t2 === void 0 ? void 0 : t2.paused) === null || e2 === void 0 || e2;
31943
31949
  }
31944
31950
  get ended() {
31945
31951
  var t2, e2;
31946
- return (e2 = (t2 = this.videoResource.source) === null || t2 === void 0 ? void 0 : t2.ended) === null || e2 === void 0 || e2;
31952
+ return (e2 = (t2 = this.videoElement) === null || t2 === void 0 ? void 0 : t2.ended) === null || e2 === void 0 || e2;
31947
31953
  }
31948
31954
  get duration() {
31949
31955
  var t2, e2;
31950
- return (e2 = (t2 = this.videoResource.source) === null || t2 === void 0 ? void 0 : t2.duration) !== null && e2 !== void 0 ? e2 : 0;
31956
+ return (e2 = (t2 = this.videoElement) === null || t2 === void 0 ? void 0 : t2.duration) !== null && e2 !== void 0 ? e2 : 0;
31951
31957
  }
31952
31958
  get clippedDuration() {
31953
31959
  return this.controller.clippedDuration;
@@ -31962,14 +31968,14 @@ void main(void){
31962
31968
  var t2;
31963
31969
  return c_(this, void 0, void 0, function* () {
31964
31970
  this.isPlaying = true, this.updateVolume(this.ctx.volumeAdjuster.volume), yield this.load(), yield this.ctx.clock.waitUntil(() => {
31965
- const t3 = this.videoResource.source;
31971
+ const t3 = this.videoElement;
31966
31972
  return !!(t3 && t3.videoWidth > 0);
31967
31973
  }, 3e3);
31968
- const e2 = this.videoResource.source;
31969
- e2 && e2.videoWidth <= 0 || (qy.RtcAudioClazz ? (this.videoResource.source.volume = 0, this.videoResource.source.muted = true, this.rtcAudio.once("play", () => {
31974
+ const e2 = this.videoElement;
31975
+ e2 && e2.videoWidth <= 0 || (qy.RtcAudioClazz ? (this.videoElement && (this.videoElement.volume = 0, this.videoElement.muted = true), this.rtcAudio.once("play", () => {
31970
31976
  var t3;
31971
- this.fullscreen && (this.requestFullscreen(), this.ctx.eventHub.emit(Yy.fullscreenChange, { targetId: this.id, state: true })), (t3 = this.videoResource.source) === null || t3 === void 0 || t3.play();
31972
- }), this.rtcAudio.play()) : (this.fullscreen && (this.requestFullscreen(), this.ctx.eventHub.emit(Yy.fullscreenChange, { targetId: this.id, state: true })), yield (t2 = this.videoResource.source) === null || t2 === void 0 ? void 0 : t2.play()));
31977
+ this.fullscreen && (this.requestFullscreen(), this.ctx.eventHub.emit(Yy.fullscreenChange, { targetId: this.id, state: true })), (t3 = this.videoElement) === null || t3 === void 0 || t3.play();
31978
+ }), this.rtcAudio.play()) : (this.fullscreen && (this.requestFullscreen(), this.ctx.eventHub.emit(Yy.fullscreenChange, { targetId: this.id, state: true })), yield (t2 = this.videoElement) === null || t2 === void 0 ? void 0 : t2.play()));
31973
31979
  });
31974
31980
  }
31975
31981
  load() {
@@ -31979,8 +31985,8 @@ void main(void){
31979
31985
  var t2;
31980
31986
  this.isPlaying = false, this.ctx.logger.warn(this.url + ", pause video manual.", this.ctx.taskId), qy.RtcAudioClazz ? (this.ctx.logger.warn(this.url + ", pause rtc audio manual.", this.ctx.taskId), this.rtcAudio.once("pause", () => {
31981
31987
  var t3;
31982
- (t3 = this.videoResource.source) === null || t3 === void 0 || t3.pause();
31983
- }), this.rtcAudio.pause()) : (t2 = this.videoResource.source) === null || t2 === void 0 || t2.pause();
31988
+ (t3 = this.videoElement) === null || t3 === void 0 || t3.pause();
31989
+ }), this.rtcAudio.pause()) : (t2 = this.videoElement) === null || t2 === void 0 || t2.pause();
31984
31990
  }
31985
31991
  globalPause() {
31986
31992
  this.isPlaying && (this.isGlobalPause = true, this.pause());
@@ -36140,7 +36146,7 @@ void main(void){
36140
36146
  }
36141
36147
  var mT = { 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" }, gT = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, vT = "";
36142
36148
  try {
36143
- vT = "0.9.2";
36149
+ vT = "0.10.0";
36144
36150
  } catch (t2) {
36145
36151
  vT = "-dev";
36146
36152
  }
@@ -39205,7 +39211,7 @@ class SlidePreviewer {
39205
39211
  }
39206
39212
  }
39207
39213
  const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
39208
- const version = "0.2.28";
39214
+ const version = "0.2.29-beta.1";
39209
39215
  const SlideApp = {
39210
39216
  kind: "Slide",
39211
39217
  setup(context) {