@gcorevideo/player 2.23.0 → 2.23.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/index.js CHANGED
@@ -43303,7 +43303,7 @@ class Player {
43303
43303
  }
43304
43304
  }
43305
43305
 
43306
- var version$1 = "2.23.0";
43306
+ var version$1 = "2.23.1";
43307
43307
 
43308
43308
  var packages = {
43309
43309
  "node_modules/@clappr/core": {
@@ -52144,16 +52144,16 @@ class Thumbnails extends UICorePlugin {
52144
52144
  this.update();
52145
52145
  }
52146
52146
  mount() {
52147
- // insert after the background TODO figure out why
52148
52147
  const mediaControl = this.core.getPlugin('media_control');
52149
- mediaControl.$el.find('.seek-time').css('bottom', 56); // TODO check
52150
- // TODO use mediaControl.mount? into the `layer`
52151
- mediaControl.$el.append(this.$el);
52148
+ mediaControl.$el.find('.seek-time').css('bottom', 56); // TODO check the offset
52149
+ mediaControl.$el.first().after(this.$el);
52152
52150
  }
52153
52151
  onMouseMoveSeekbar(_, pos) {
52154
- this.hoverPosition = pos;
52155
- this.showing = true;
52156
- this.update();
52152
+ if (Math.abs(pos - this.hoverPosition) >= 0.01) {
52153
+ this.hoverPosition = pos;
52154
+ this.showing = true;
52155
+ this.update();
52156
+ }
52157
52157
  }
52158
52158
  onMouseLeave() {
52159
52159
  this.showing = false;
@@ -52161,9 +52161,9 @@ class Thumbnails extends UICorePlugin {
52161
52161
  }
52162
52162
  // builds a dom element which represents the thumbnail
52163
52163
  // scaled to the given height
52164
- buildThumbImage(thumb, height) {
52164
+ buildThumbImage(thumb, height, $ref) {
52165
52165
  const scaleFactor = height / thumb.h;
52166
- const $container = $('<div />').addClass('thumbnail-container');
52166
+ const $container = $ref && $ref.length ? $ref : $('<div />').addClass('thumbnail-container');
52167
52167
  $container.css('width', thumb.w * scaleFactor);
52168
52168
  $container.css('height', height);
52169
52169
  $container.css({
@@ -52267,8 +52267,7 @@ class Thumbnails extends UICorePlugin {
52267
52267
  const thumb = this.thumbs[thumbIndex];
52268
52268
  // update thumbnail
52269
52269
  const $spotlight = this.$el.find('#thumbnails-spotlight');
52270
- $spotlight.empty();
52271
- $spotlight.append(this.buildThumbImage(thumb, this.spotlightHeight));
52270
+ this.buildThumbImage(thumb, this.spotlightHeight, $spotlight.find('.thumbnail-container')).appendTo($spotlight);
52272
52271
  const elWidth = this.$el.width();
52273
52272
  const thumbWidth = $spotlight.width();
52274
52273
  const thumbHeight = $spotlight.height();
@@ -1 +1 @@
1
- {"version":3,"file":"Thumbnails.d.ts","sourceRoot":"","sources":["../../../src/plugins/thumbnails/Thumbnails.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAKZ,IAAI,EACL,MAAM,cAAc,CAAA;AAUrB,OAAO,uCAAuC,CAAA;AAM9C;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,qBAAqB,CAAoB;IAEjD,OAAO,CAAC,iBAAiB,CAAY;IAErC,OAAO,CAAC,gBAAgB,CAAY;IAEpC,OAAO,CAAC,aAAa,CAAI;IAEzB,OAAO,CAAC,OAAO,CAAQ;IAEvB,OAAO,CAAC,YAAY,CAAQ;IAE5B,OAAO,CAAC,eAAe,CAAI;IAE3B,OAAO,CAAC,cAAc,CAAI;IAE1B,OAAO,CAAC,MAAM,CAAsB;IAEpC;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACH,IAAa,UAAU;;MAIt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AAO,CAAC,aAAa,CAAI;IAEzB,OAAO,CAAC,OAAO,CAAQ;IAEvB,OAAO,CAAC,YAAY,CAAQ;IAE5B,OAAO,CAAC,eAAe,CAAI;IAE3B,OAAO,CAAC,cAAc,CAAI;IAE1B,OAAO,CAAC,MAAM,CAAsB;IAEpC;;OAEG;IACH,IAAI,IAAI,WAEP;IAED;;OAEG;IACH,IAAI,gBAAgB;;MAEnB;IAED;;OAEG;IACH,IAAa,UAAU;;MAItB;IAED,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAuB;gBAE3C,IAAI,EAAE,IAAI;IAgBtB,OAAO,CAAC,iBAAiB;IAiCzB;;OAEG;IACM,UAAU;IAInB,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,WAAW;YAmDL,eAAe;IAO7B,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,IAAI;IAaZ,OAAO,CAAC,KAAK;IAMb,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,eAAe;IAuBvB,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,OAAO;IAUf,OAAO,CAAC,cAAc;IAuEtB,OAAO,CAAC,oBAAoB;IAkD5B,OAAO,CAAC,oBAAoB;IAa5B,OAAO,CAAC,MAAM;IAad,OAAO,CAAC,WAAW;IAgBnB,OAAO,KAAK,YAAY,GAMvB;IAEQ,MAAM;CAShB"}
@@ -169,16 +169,16 @@ export class Thumbnails extends UICorePlugin {
169
169
  this.update();
170
170
  }
171
171
  mount() {
172
- // insert after the background TODO figure out why
173
172
  const mediaControl = this.core.getPlugin('media_control');
174
- mediaControl.$el.find('.seek-time').css('bottom', 56); // TODO check
175
- // TODO use mediaControl.mount? into the `layer`
176
- mediaControl.$el.append(this.$el);
173
+ mediaControl.$el.find('.seek-time').css('bottom', 56); // TODO check the offset
174
+ mediaControl.$el.first().after(this.$el);
177
175
  }
178
176
  onMouseMoveSeekbar(_, pos) {
179
- this.hoverPosition = pos;
180
- this.showing = true;
181
- this.update();
177
+ if (Math.abs(pos - this.hoverPosition) >= 0.01) {
178
+ this.hoverPosition = pos;
179
+ this.showing = true;
180
+ this.update();
181
+ }
182
182
  }
183
183
  onMouseLeave() {
184
184
  this.showing = false;
@@ -186,9 +186,9 @@ export class Thumbnails extends UICorePlugin {
186
186
  }
187
187
  // builds a dom element which represents the thumbnail
188
188
  // scaled to the given height
189
- buildThumbImage(thumb, height) {
189
+ buildThumbImage(thumb, height, $ref) {
190
190
  const scaleFactor = height / thumb.h;
191
- const $container = $('<div />').addClass('thumbnail-container');
191
+ const $container = $ref && $ref.length ? $ref : $('<div />').addClass('thumbnail-container');
192
192
  $container.css('width', thumb.w * scaleFactor);
193
193
  $container.css('height', height);
194
194
  $container.css({
@@ -292,8 +292,7 @@ export class Thumbnails extends UICorePlugin {
292
292
  const thumb = this.thumbs[thumbIndex];
293
293
  // update thumbnail
294
294
  const $spotlight = this.$el.find('#thumbnails-spotlight');
295
- $spotlight.empty();
296
- $spotlight.append(this.buildThumbImage(thumb, this.spotlightHeight));
295
+ this.buildThumbImage(thumb, this.spotlightHeight, $spotlight.find('.thumbnail-container')).appendTo($spotlight);
297
296
  const elWidth = this.$el.width();
298
297
  const thumbWidth = $spotlight.width();
299
298
  const thumbHeight = $spotlight.height();
@@ -1 +1 @@
1
- {"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,MAAM,MAAM,eAAe,CAAA;AAGlC,wBAAgB,cAAc,CAC5B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,SAAS,GAAE,GAAkC;;;;;;;;;;;;;;;;EAqB9C;AAED,wBAAgB,gBAAgB;;;EAK/B;AAED,wBAAgB,mBAAmB;;;;;;EAKlC;AAED,wBAAgB,kBAAkB,CAAC,IAAI,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmC/C;AAED,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,QAAQ,GAAE,GAA0B;;;;;;;;;;;;;;;;;;;;;;;EA4BrC;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,gBAc/C;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,GAAG,OAe7C"}
1
+ {"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,MAAM,MAAM,eAAe,CAAA;AAGlC,wBAAgB,cAAc,CAC5B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,SAAS,GAAE,GAAkC;;;;;;;;;;;;;;;;EAqB9C;AAED,wBAAgB,gBAAgB;;;EAK/B;AAED,wBAAgB,mBAAmB;;;;;;EAKlC;AAED,wBAAgB,kBAAkB,CAAC,IAAI,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmC/C;AAED,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,QAAQ,GAAE,GAA0B;;;;;;;;;;;;;;;;;;;;;;;EA4BrC;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,gBAe/C;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,GAAG,OAe7C"}
package/lib/testUtils.js CHANGED
@@ -109,6 +109,7 @@ export function createMockMediaControl(core) {
109
109
  // @ts-ignore
110
110
  mediaControl.toggleElement = vi.fn();
111
111
  vi.spyOn(mediaControl, 'trigger');
112
+ core.$el.append(mediaControl.$el);
112
113
  return mediaControl;
113
114
  }
114
115
  export function createMockBottomGear(core) {
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@gcorevideo/player",
3
- "version": "2.23.0",
3
+ "version": "2.23.1",
4
4
  "description": "Gcore JavaScript video player",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "typings": "lib/index.d.ts",
8
- "keywords": ["player", "video streaming"],
8
+ "keywords": [
9
+ "player",
10
+ "video streaming"
11
+ ],
9
12
  "scripts": {
10
13
  "build": "npm run build:ts && npm run build:bundle",
11
14
  "build:1": "npm run build:ts && npm run build:bundle && date",
@@ -255,17 +255,17 @@ export class Thumbnails extends UICorePlugin {
255
255
  }
256
256
 
257
257
  private mount() {
258
- // insert after the background TODO figure out why
259
258
  const mediaControl = this.core.getPlugin('media_control') as MediaControl
260
- mediaControl.$el.find('.seek-time').css('bottom', 56) // TODO check
261
- // TODO use mediaControl.mount? into the `layer`
262
- mediaControl.$el.append(this.$el)
259
+ mediaControl.$el.find('.seek-time').css('bottom', 56) // TODO check the offset
260
+ mediaControl.$el.first().after(this.$el);
263
261
  }
264
262
 
265
263
  private onMouseMoveSeekbar(_: MouseEvent, pos: number) {
266
- this.hoverPosition = pos
267
- this.showing = true
268
- this.update()
264
+ if (Math.abs(pos - this.hoverPosition) >= 0.01) {
265
+ this.hoverPosition = pos
266
+ this.showing = true
267
+ this.update()
268
+ }
269
269
  }
270
270
 
271
271
  private onMouseLeave() {
@@ -275,9 +275,13 @@ export class Thumbnails extends UICorePlugin {
275
275
 
276
276
  // builds a dom element which represents the thumbnail
277
277
  // scaled to the given height
278
- private buildThumbImage(thumb: ThumbnailDesc, height: number) {
278
+ private buildThumbImage(
279
+ thumb: ThumbnailDesc,
280
+ height: number,
281
+ $ref?: ZeptoResult,
282
+ ) {
279
283
  const scaleFactor = height / thumb.h
280
- const $container = $('<div />').addClass('thumbnail-container')
284
+ const $container = $ref && $ref.length ? $ref : $('<div />').addClass('thumbnail-container')
281
285
 
282
286
  $container.css('width', thumb.w * scaleFactor)
283
287
  $container.css('height', height)
@@ -414,8 +418,11 @@ export class Thumbnails extends UICorePlugin {
414
418
  // update thumbnail
415
419
  const $spotlight = this.$el.find('#thumbnails-spotlight')
416
420
 
417
- $spotlight.empty()
418
- $spotlight.append(this.buildThumbImage(thumb, this.spotlightHeight))
421
+ this.buildThumbImage(
422
+ thumb,
423
+ this.spotlightHeight,
424
+ $spotlight.find('.thumbnail-container'),
425
+ ).appendTo($spotlight)
419
426
 
420
427
  const elWidth = this.$el.width()
421
428
  const thumbWidth = $spotlight.width()
@@ -55,14 +55,14 @@ sprite.png#xywh=200,200,100,100
55
55
  it('should render', () => {
56
56
  expect(thumbnails.$el.html()).toMatchSnapshot()
57
57
  })
58
- it('should mount to media controls', () => {
59
- expect(mediaControl.$el.find('.scrub-thumbnails')).toHaveLength(1)
58
+ it('should mount along with media controls', () => {
59
+ expect(core.$el.find('.scrub-thumbnails')).toHaveLength(1)
60
60
  })
61
61
  it('should load image dimensions', () => {
62
62
  expect(loadImageDimensions).toHaveBeenCalledWith('https://example.com/sprite.png')
63
63
  })
64
64
  it('should parse sprite sheet and create thumbnails', () => {
65
- const thumbs = mediaControl.$el.find('#thumbnails-carousel .thumbnail-container')
65
+ const thumbs = thumbnails.$el.find('#thumbnails-carousel .thumbnail-container')
66
66
  expect(thumbs).toHaveLength(2)
67
67
  })
68
68
  it('should hide', () => {
package/src/testUtils.ts CHANGED
@@ -123,6 +123,7 @@ export function createMockMediaControl(core: any) {
123
123
  // @ts-ignore
124
124
  mediaControl.toggleElement = vi.fn()
125
125
  vi.spyOn(mediaControl, 'trigger')
126
+ core.$el.append(mediaControl.$el)
126
127
  return mediaControl
127
128
  }
128
129