@gcorevideo/player 0.0.5 → 0.2.3

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.
@@ -16,8 +16,9 @@ import HLSJS, {
16
16
  type LevelLoadedData,
17
17
  type LevelSwitchingData,
18
18
  } from 'hls.js';
19
- import { PlaybackType } from '../../types';
19
+
20
20
  import { TimePosition } from '../../playback.types.js';
21
+ import { PlaybackType } from '../../types';
21
22
  import { TimerId } from '../../utils/types';
22
23
 
23
24
  const { now, listContainsIgnoreCase } = Utils;
@@ -904,6 +905,9 @@ export default class HlsPlayback extends HTML5Video {
904
905
  HlsPlayback.canPlay = function (resource: string, mimeType?: string): boolean {
905
906
  const resourceParts = resource.split('?')[0].match(/.*\.(.*)$/) || [];
906
907
  const isHls = ((resourceParts.length > 1 && resourceParts[1].toLowerCase() === 'm3u8') || listContainsIgnoreCase(mimeType, ['application/vnd.apple.mpegurl', 'application/x-mpegURL']));
907
-
908
- return !!(HLSJS.isSupported() && isHls);
908
+ const isSupported = HLSJS.isSupported();
909
+ Log.debug(T, 'canPlay', {
910
+ isSupported, isHls,
911
+ })
912
+ return !!(isSupported && isHls);
909
913
  };
package/src/types.ts CHANGED
@@ -7,11 +7,9 @@ export type TransportPreference = MediaTransport | 'auto';
7
7
 
8
8
  export type PlayerPlugin = {
9
9
  new(...args: any[]): unknown;
10
- type: 'core' | 'container' | 'playback';
10
+ type: string; // 'core' | 'container' | 'playback';
11
11
  }
12
12
 
13
- // export type PluginName = StdPluginName | string;
14
-
15
13
  export type PlayerConfig = {
16
14
  autoPlay?: boolean;
17
15
  debug?: PlayerDebugSettings;
@@ -20,7 +18,6 @@ export type PlayerConfig = {
20
18
  multisources: StreamMediaSource[];
21
19
  mute?: boolean;
22
20
  playbackType: PlaybackType;
23
- // plugins?: PluginName[];
24
21
  pluginSettings?: Record<string, unknown>;
25
22
  poster?: string;
26
23
  priorityTransport?: TransportPreference;
@@ -79,8 +76,8 @@ export type StreamMediaSourceDto = {
79
76
  export type StreamMediaSource = {
80
77
  description: string;
81
78
  dvr: boolean;
82
- hlsCmafUrl?: string;
83
- hlsMpegtsUrl?: string;
79
+ hlsCmafUrl: string | null;
80
+ hlsMpegtsUrl: string | null;
84
81
  id: number;
85
82
  live: boolean;
86
83
  priorityTransport: TransportPreference;
@@ -98,3 +95,18 @@ export type SrcProjectionType = 'regular' | '360' | 'vr180' | 'vr360tb';
98
95
  export type ProjectionType = '360' | '180' | '360_TB';
99
96
 
100
97
  export type TranslationSettings = Partial<Record<LangTag, Record<TranslationKey, string>>>;
98
+
99
+ export type BitrateInfo = {
100
+ height: number;
101
+ width: number;
102
+ bitrate: number;
103
+ level: number;
104
+ };
105
+
106
+ export enum PlayerEvent {
107
+ Ready = 'ready',
108
+ Play = 'play',
109
+ Pause = 'pause',
110
+ Stop = 'stop',
111
+ Ended = 'ended',
112
+ }
@@ -12,13 +12,6 @@ declare module "@clappr/core" {
12
12
 
13
13
  type PlayerMediaSource = string | PlayerMediaSourceDesc;
14
14
 
15
- type ExternalTrack = {
16
- kind?: "subtitles";
17
- src: string;
18
- label: string;
19
- lang: string;
20
- }
21
-
22
15
  type HlsjsConfig = {
23
16
  debug?: boolean;
24
17
  startLevel?: number;
@@ -0,0 +1,23 @@
1
+ import { Core, UICorePlugin } from "@clappr/core";
2
+ import "@clappr/plugins";
3
+
4
+ declare module "@clappr/plugins" {
5
+ declare type MediaControlOptions = {
6
+ hideMediaControlDelay?: number;
7
+ chromeless?: boolean;
8
+ source?: string;
9
+ sources?: string[];
10
+ baseUrl?: string;
11
+ disableKeyboardShortcuts?: boolean;
12
+ width?: number;
13
+ height?: number;
14
+ persistConfig?: boolean; // TODO
15
+ focusElement?: HTMLElement;
16
+ hideVolumeBar?: boolean;
17
+ parentElement?: HTMLElement;
18
+ mediacontrol?: {
19
+ buttons: string;
20
+ seekbar: string;
21
+ }
22
+ }
23
+ }
@@ -36,29 +36,3 @@ export function strtimeToMiliseconds(str: string): number {
36
36
 
37
37
  return (h + m + s);
38
38
  }
39
-
40
- // TODO refactor
41
- export function isFullscreen(el: HTMLElement): boolean {
42
- const video = el.nodeName === "video" ? el as HTMLVideoElement : el.querySelector('video');
43
- assert.ok(video, 'element must be a video or contain a video element');
44
-
45
- if (Browser.isiOS) {
46
- return FullscreenIOS.isFullscreen(video);
47
- }
48
- return !!(document.fullscreenElement);
49
- }
50
-
51
- export const FullscreenIOS = {
52
- isFullscreen: function (el: HTMLVideoElement): boolean {
53
- try {
54
- if (el.webkitDisplayingFullscreen !== undefined) {
55
- return !!(el.webkitDisplayingFullscreen);
56
- }
57
- } catch (e) {
58
- // LogManager.exception(error);
59
- reportError(e);
60
- }
61
-
62
- return false;
63
- }
64
- };
package/src/version.ts ADDED
@@ -0,0 +1,9 @@
1
+ import * as pkg from '../package.json' with { "type": "json" };
2
+ import * as lock from '../package-lock.json' with { "type": "json" };
3
+
4
+ export function version() {
5
+ return {
6
+ gplayer: pkg.version,
7
+ clappr: lock.packages['node_modules/@clappr/core'].version,
8
+ }
9
+ }