cloudinary-video-player 1.5.5 → 1.5.9

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +140 -21
  2. package/dist/cld-video-player.css +229 -2079
  3. package/dist/cld-video-player.js +200 -483
  4. package/dist/cld-video-player.light.css +231 -2081
  5. package/dist/cld-video-player.light.js +71 -23
  6. package/dist/cld-video-player.light.min.css +1 -1
  7. package/dist/cld-video-player.light.min.js +2 -23
  8. package/dist/cld-video-player.light.min.js.LICENSE.txt +23 -0
  9. package/dist/cld-video-player.min.css +1 -1
  10. package/dist/cld-video-player.min.js +2 -27
  11. package/dist/cld-video-player.min.js.LICENSE.txt +26 -0
  12. package/docs/interaction-area.html +104 -64
  13. package/package.json +23 -23
  14. package/src/assets/styles/components/interaction-areas.scss +165 -0
  15. package/src/assets/styles/components/themedButton.scss +48 -0
  16. package/src/assets/styles/icons.scss +149 -217
  17. package/src/assets/styles/main.scss +8 -30
  18. package/src/components/interaction-area/interaction-area.const.js +30 -0
  19. package/src/components/interaction-area/interaction-area.service.js +225 -0
  20. package/src/components/interaction-area/interaction-area.utils.js +236 -0
  21. package/src/components/logoButton/logo-button.js +3 -6
  22. package/src/components/themeButton/themedButton.const.js +3 -0
  23. package/src/components/themeButton/themedButton.js +25 -0
  24. package/src/config/defaults.js +3 -2
  25. package/src/extended-events.js +3 -0
  26. package/src/plugins/cloudinary/common.js +14 -6
  27. package/src/plugins/cloudinary/models/video-source/video-source.js +16 -12
  28. package/src/plugins/cloudinary/models/video-source/video-source.utils.js +28 -1
  29. package/src/plugins/colors/index.js +6 -1
  30. package/src/plugins/dash/videojs-dash.js +1 -1
  31. package/src/plugins/floating-player/index.js +3 -1
  32. package/src/utils/array.js +21 -0
  33. package/src/utils/dom.js +41 -2
  34. package/src/utils/object.js +26 -0
  35. package/src/utils/time.js +28 -1
  36. package/src/utils/type-inference.js +5 -1
  37. package/src/validators/validators-functions.js +48 -0
  38. package/src/validators/validators-types.js +78 -0
  39. package/src/validators/validators.js +110 -0
  40. package/src/video-player.const.js +23 -16
  41. package/src/video-player.js +47 -127
  42. package/src/video-player.utils.js +9 -70
  43. package/test/isValidConfig.test.js +224 -0
  44. package/test/unit/utils.test.js +27 -0
  45. package/test/unit/videoSource.test.js +155 -0
  46. package/types/video-player.d.ts +1 -1
@@ -1,5 +1,6 @@
1
1
  import VideoSource from '../../src/plugins/cloudinary/models/video-source/video-source.js';
2
2
  import cloudinary from 'cloudinary-core';
3
+ import { isCodecAlreadyExist } from '../../src/plugins/cloudinary/models/video-source/video-source.utils';
3
4
  const cld = cloudinary.Cloudinary.new({ cloud_name: 'demo' });
4
5
 
5
6
  describe('video source tests', () => {
@@ -297,3 +298,157 @@ describe('tests withCredentials', () => {
297
298
  });
298
299
 
299
300
 
301
+ describe('test isCodecAlreadyExist method', () => {
302
+
303
+ describe('test has codec in raw transformation', () => {
304
+
305
+ it('should codec already exist', () => {
306
+ expect(isCodecAlreadyExist(null, 'vc_vp9,q_auto')).toEqual(true);
307
+ });
308
+
309
+ it('should codec not exist', () => {
310
+ expect(isCodecAlreadyExist(null, 'q_auto')).toEqual(false);
311
+ });
312
+ });
313
+
314
+
315
+ describe('test has codec in transformation object', () => {
316
+
317
+ it('codec exist in transformation object', () => {
318
+ const transformations = {
319
+ video_codec: 'vp9'
320
+ };
321
+
322
+ expect(isCodecAlreadyExist(transformations)).toEqual(true);
323
+ });
324
+
325
+ it('codec NOT exist in transformation object', () => {
326
+
327
+ const transformations = {
328
+ quality: 'auto'
329
+ };
330
+
331
+ expect(isCodecAlreadyExist(transformations)).toEqual(false);
332
+ });
333
+ });
334
+
335
+ describe('test if codec exist in transformations array', () => {
336
+
337
+ it('codec exist in transformation array', () => {
338
+ const transformations = [
339
+ {
340
+ toOptions: () => ({ transformation: ['vc_vp9,q_auto'] })
341
+ }
342
+ ];
343
+
344
+ expect(isCodecAlreadyExist(transformations)).toEqual(true);
345
+ });
346
+
347
+
348
+ it('codec NOT exist in transformation array', () => {
349
+ const transformations = [
350
+ {
351
+ toOptions: () => ({ transformation: ['q_auto'] })
352
+ }
353
+ ];
354
+
355
+ expect(isCodecAlreadyExist(transformations)).toEqual(false);
356
+ });
357
+
358
+ });
359
+
360
+
361
+ describe('should generated codec in source url', () => {
362
+
363
+ it('should get default code', () => {
364
+
365
+ const source = new VideoSource('sea_turtle', {
366
+ cloudinaryConfig: cld
367
+ });
368
+
369
+ const srcs = source.generateSources();
370
+ expect(srcs[0].src).toEqual('http://res.cloudinary.com/demo/video/upload/vc_vp9/sea_turtle.webm');
371
+ });
372
+
373
+ it('check if codec has NOT bee added to the ur twice', () => {
374
+
375
+ const source = new VideoSource('sea_turtle', {
376
+ cloudinaryConfig: cld,
377
+ transformation: {
378
+ video_codec: 'vp9'
379
+ }
380
+ });
381
+
382
+ const srcs = source.generateSources();
383
+ expect(srcs[0].src).toEqual('http://res.cloudinary.com/demo/video/upload/vc_vp9/sea_turtle.webm');
384
+ });
385
+
386
+ it('check if codec has been changed', () => {
387
+
388
+ const source = new VideoSource('sea_turtle', {
389
+ cloudinaryConfig: cld,
390
+ transformation: {
391
+ video_codec: 'h265'
392
+ }
393
+ });
394
+
395
+ const srcs = source.generateSources();
396
+ expect(srcs[0].src).toEqual('http://res.cloudinary.com/demo/video/upload/vc_h265/sea_turtle.webm');
397
+ });
398
+
399
+
400
+ it('check if codec has been NOT add twice using raw_transformation', () => {
401
+
402
+ const source = new VideoSource('sea_turtle', {
403
+ cloudinaryConfig: cld,
404
+ raw_transformation: 'vc_vp9'
405
+ });
406
+
407
+ const srcs = source.generateSources();
408
+ expect(srcs[0].src).toEqual('http://res.cloudinary.com/demo/video/upload/vc_vp9/sea_turtle.webm');
409
+ });
410
+
411
+ it('check if codec has been change using raw_transformation', () => {
412
+
413
+ const source = new VideoSource('sea_turtle', {
414
+ cloudinaryConfig: cld,
415
+ raw_transformation: 'h265'
416
+ });
417
+
418
+ const srcs = source.generateSources();
419
+ expect(srcs[0].src).toEqual('http://res.cloudinary.com/demo/video/upload/h265/sea_turtle.webm');
420
+ });
421
+
422
+
423
+ it('check array of transformations without codec', () => {
424
+
425
+ const source = new VideoSource('sea_turtle', {
426
+ cloudinaryConfig: cld,
427
+ transformation: [
428
+ { width: 400 }
429
+ ]
430
+ });
431
+
432
+ const srcs = source.generateSources();
433
+ expect(srcs[0].src).toEqual('http://res.cloudinary.com/demo/video/upload/vc_vp9/sea_turtle.webm');
434
+ });
435
+
436
+ it('check array of transformations with codec', () => {
437
+
438
+ const source = new VideoSource('sea_turtle', {
439
+ cloudinaryConfig: cld,
440
+ transformation: [
441
+ { video_codec: 'h265' }
442
+ ]
443
+ });
444
+
445
+ const srcs = source.generateSources();
446
+ expect(srcs[0].src).toEqual('http://res.cloudinary.com/demo/video/upload/vc_h265/sea_turtle.webm');
447
+ });
448
+
449
+
450
+ });
451
+
452
+ });
453
+
454
+
@@ -126,7 +126,7 @@ export interface Options {
126
126
  ads?: AdsOptions,
127
127
  analytics?: boolean,
128
128
  allowUsageReport?: boolean,
129
- videoJS?: VideoJsPlayerOptions;
129
+ videojs?: VideoJsPlayerOptions;
130
130
  }
131
131
 
132
132
  /**