cloudinary-video-player 1.6.2-edge.13

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 (226) hide show
  1. package/.eslintignore +4 -0
  2. package/.snyk +19 -0
  3. package/.travis.yml +8 -0
  4. package/CHANGELOG.md +329 -0
  5. package/LICENSE +21 -0
  6. package/README.md +87 -0
  7. package/dist/cld-video-player.css +2110 -0
  8. package/dist/cld-video-player.js +5249 -0
  9. package/dist/cld-video-player.light.css +1766 -0
  10. package/dist/cld-video-player.light.js +1399 -0
  11. package/dist/cld-video-player.light.min.css +1 -0
  12. package/dist/cld-video-player.light.min.js +2 -0
  13. package/dist/cld-video-player.light.min.js.LICENSE.txt +23 -0
  14. package/dist/cld-video-player.min.css +1 -0
  15. package/dist/cld-video-player.min.js +2 -0
  16. package/dist/cld-video-player.min.js.LICENSE.txt +26 -0
  17. package/dist/fonts/cloudinary_icon_for_black_bg.svg +69 -0
  18. package/dist/fonts/cloudinary_icon_for_white_bg.svg +69 -0
  19. package/docs/360.html +102 -0
  20. package/docs/_template.html +93 -0
  21. package/docs/adaptive-streaming.html +297 -0
  22. package/docs/analytics.html +140 -0
  23. package/docs/api.html +302 -0
  24. package/docs/audio.html +136 -0
  25. package/docs/autoplay-fallback.html +138 -0
  26. package/docs/autoplay-on-scroll.html +107 -0
  27. package/docs/codec-fallback.html +158 -0
  28. package/docs/colors.html +135 -0
  29. package/docs/components.html +284 -0
  30. package/docs/custom-cld-errors.html +134 -0
  31. package/docs/floating-player.html +98 -0
  32. package/docs/fluid.html +117 -0
  33. package/docs/force-hls-subtitles-ios.html +159 -0
  34. package/docs/index.html +83 -0
  35. package/docs/interaction-area.html +398 -0
  36. package/docs/live-customer.html +128 -0
  37. package/docs/multiple-players.html +125 -0
  38. package/docs/playlist-by-tag-cap.html +182 -0
  39. package/docs/playlist-by-tag.html +133 -0
  40. package/docs/playlist.html +133 -0
  41. package/docs/poster.html +155 -0
  42. package/docs/raw-url.html +104 -0
  43. package/docs/recommendations.html +155 -0
  44. package/docs/scripts.js +156 -0
  45. package/docs/seek-thumbs.html +90 -0
  46. package/docs/shoppable.html +335 -0
  47. package/docs/subtitles-and-captions.html +267 -0
  48. package/docs/transformations.html +171 -0
  49. package/docs/ui-config.html +108 -0
  50. package/docs/vast-vpaid.html +149 -0
  51. package/env.example.js +6 -0
  52. package/env.js +6 -0
  53. package/jest-puppeteer.config.js +14 -0
  54. package/jest.config.js +196 -0
  55. package/package.json +99 -0
  56. package/sandbox.config.json +3 -0
  57. package/setupJest.js +1 -0
  58. package/src/assets/fonts/VideoJS.svg +120 -0
  59. package/src/assets/fonts/VideoJS.ttf +0 -0
  60. package/src/assets/fonts/VideoJS.woff +0 -0
  61. package/src/assets/fonts/icons.json +120 -0
  62. package/src/assets/icons/cloudinary_icon_for_black_bg.svg +69 -0
  63. package/src/assets/icons/cloudinary_icon_for_white_bg.svg +69 -0
  64. package/src/assets/icons/cloudinary_logo_for_dark_bg.svg +188 -0
  65. package/src/assets/icons/cloudinary_logo_for_white_bg.svg +188 -0
  66. package/src/assets/icons/info-circle.svg +17 -0
  67. package/src/assets/styles/ads-label.scss +16 -0
  68. package/src/assets/styles/components/interaction-areas.scss +158 -0
  69. package/src/assets/styles/components/playlist.scss +213 -0
  70. package/src/assets/styles/components/themedButton.scss +48 -0
  71. package/src/assets/styles/components/thumbnail.scss +94 -0
  72. package/src/assets/styles/components/title-bar.scss +67 -0
  73. package/src/assets/styles/components/triangle-volume-bar.scss +52 -0
  74. package/src/assets/styles/icons.scss +257 -0
  75. package/src/assets/styles/main.scss +324 -0
  76. package/src/assets/styles/mixins/aspect-ratio.scss +16 -0
  77. package/src/assets/styles/mixins/disable-transition.scss +3 -0
  78. package/src/assets/styles/mixins/mixins.scss +5 -0
  79. package/src/assets/styles/mixins/skin.scss +64 -0
  80. package/src/assets/styles/variables.scss +2 -0
  81. package/src/assets/styles/videojs-ima.scss +252 -0
  82. package/src/components/component-utils.js +20 -0
  83. package/src/components/index.js +21 -0
  84. package/src/components/interaction-area/interaction-area.const.js +30 -0
  85. package/src/components/interaction-area/interaction-area.service.js +223 -0
  86. package/src/components/interaction-area/interaction-area.utils.js +236 -0
  87. package/src/components/jumpButtons/jump-10-minus.js +21 -0
  88. package/src/components/jumpButtons/jump-10-plus.js +20 -0
  89. package/src/components/logoButton/logo-button.const.js +3 -0
  90. package/src/components/logoButton/logo-button.js +30 -0
  91. package/src/components/logoButton/logo-button.scss +15 -0
  92. package/src/components/playlist/components/playlist-button.js +34 -0
  93. package/src/components/playlist/components/playlist-next-button.js +18 -0
  94. package/src/components/playlist/components/playlist-previous-button.js +18 -0
  95. package/src/components/playlist/components/playlist.js +5 -0
  96. package/src/components/playlist/components/playlist.scss +15 -0
  97. package/src/components/playlist/components/upcoming-video-overlay.js +149 -0
  98. package/src/components/playlist/components/upcoming-video-overlay.scss +86 -0
  99. package/src/components/playlist/layout/playlist-layout-custom.js +21 -0
  100. package/src/components/playlist/layout/playlist-layout-horizontal.js +16 -0
  101. package/src/components/playlist/layout/playlist-layout-vertical.js +19 -0
  102. package/src/components/playlist/layout/playlist-layout.js +110 -0
  103. package/src/components/playlist/panel/playlist-panel-item.js +86 -0
  104. package/src/components/playlist/panel/playlist-panel.js +92 -0
  105. package/src/components/playlist/playlist-widget.js +119 -0
  106. package/src/components/playlist/playlist.const.js +14 -0
  107. package/src/components/playlist/playlist.js +413 -0
  108. package/src/components/playlist/thumbnail/thumbnail.js +69 -0
  109. package/src/components/progress-control-events-blocker/progress-control-events-blocker.js +17 -0
  110. package/src/components/qualitySelector/quality-selector.scss +10 -0
  111. package/src/components/qualitySelector/qualitySelector.js +152 -0
  112. package/src/components/recommendations-overlay/index.js +3 -0
  113. package/src/components/recommendations-overlay/recommendations-overlay-content.js +57 -0
  114. package/src/components/recommendations-overlay/recommendations-overlay-hide-button.js +18 -0
  115. package/src/components/recommendations-overlay/recommendations-overlay-item.js +35 -0
  116. package/src/components/recommendations-overlay/recommendations-overlay-primary-item.js +81 -0
  117. package/src/components/recommendations-overlay/recommendations-overlay-secondary-item.js +48 -0
  118. package/src/components/recommendations-overlay/recommendations-overlay-secondary-items-container.js +35 -0
  119. package/src/components/recommendations-overlay/recommendations-overlay.js +94 -0
  120. package/src/components/recommendations-overlay/recommendations-overlay.scss +182 -0
  121. package/src/components/shoppable-bar/layout/bar-layout.js +111 -0
  122. package/src/components/shoppable-bar/layout/shoppable-panel-toggle.js +64 -0
  123. package/src/components/shoppable-bar/layout/shoppable-products-overlay.js +87 -0
  124. package/src/components/shoppable-bar/panel/shoppable-panel-item.js +105 -0
  125. package/src/components/shoppable-bar/panel/shoppable-panel.js +172 -0
  126. package/src/components/shoppable-bar/shoppable-post-widget.js +110 -0
  127. package/src/components/shoppable-bar/shoppable-widget.const.js +52 -0
  128. package/src/components/shoppable-bar/shoppable-widget.js +111 -0
  129. package/src/components/shoppable-bar/shoppable-widget.scss +359 -0
  130. package/src/components/themeButton/themedButton.const.js +3 -0
  131. package/src/components/themeButton/themedButton.js +25 -0
  132. package/src/components/title-bar/title-bar.js +79 -0
  133. package/src/config/defaults.js +25 -0
  134. package/src/extended-events.js +228 -0
  135. package/src/index.js +18 -0
  136. package/src/mixins/eventable.js +54 -0
  137. package/src/mixins/playlistable.js +106 -0
  138. package/src/plugins/analytics/index.js +245 -0
  139. package/src/plugins/autoplay-on-scroll/index.js +86 -0
  140. package/src/plugins/cloudinary/common.js +216 -0
  141. package/src/plugins/cloudinary/event-handler-registry.js +46 -0
  142. package/src/plugins/cloudinary/index.js +345 -0
  143. package/src/plugins/cloudinary/models/audio-source/audio-source.const.js +11 -0
  144. package/src/plugins/cloudinary/models/audio-source/audio-source.js +82 -0
  145. package/src/plugins/cloudinary/models/base-source.js +107 -0
  146. package/src/plugins/cloudinary/models/image-source.js +26 -0
  147. package/src/plugins/cloudinary/models/video-source/video-source.const.js +32 -0
  148. package/src/plugins/cloudinary/models/video-source/video-source.js +239 -0
  149. package/src/plugins/cloudinary/models/video-source/video-source.utils.js +57 -0
  150. package/src/plugins/colors/index.js +303 -0
  151. package/src/plugins/context-menu/components/context-menu-item.js +12 -0
  152. package/src/plugins/context-menu/components/context-menu.js +63 -0
  153. package/src/plugins/context-menu/context-menu.scss +30 -0
  154. package/src/plugins/context-menu/contextMenuContent.js +53 -0
  155. package/src/plugins/context-menu/index.js +134 -0
  156. package/src/plugins/dash/index.js +26 -0
  157. package/src/plugins/dash/setup-audio-tracks.js +112 -0
  158. package/src/plugins/dash/setup-text-tracks.js +195 -0
  159. package/src/plugins/dash/videojs-dash.js +372 -0
  160. package/src/plugins/floating-player/floating-player.scss +74 -0
  161. package/src/plugins/floating-player/index.js +129 -0
  162. package/src/plugins/ima/index.js +1775 -0
  163. package/src/plugins/index.js +31 -0
  164. package/src/plugins/interactive-plugin/index.js +10 -0
  165. package/src/plugins/videojs-http-source-selector/components/SourceMenuButton.js +98 -0
  166. package/src/plugins/videojs-http-source-selector/components/SourceMenuItem.js +52 -0
  167. package/src/plugins/videojs-http-source-selector/plugin.js +82 -0
  168. package/src/plugins/videojs-http-source-selector/plugin.scss +9 -0
  169. package/src/plugins/vtt-thumbnails/index.js +526 -0
  170. package/src/plugins/vtt-thumbnails/vtt-thumbnails.scss +29 -0
  171. package/src/utils/api.js +32 -0
  172. package/src/utils/apply-with-props.js +32 -0
  173. package/src/utils/array.js +22 -0
  174. package/src/utils/assign.js +27 -0
  175. package/src/utils/attributes-normalizer.js +72 -0
  176. package/src/utils/cloudinary.js +165 -0
  177. package/src/utils/css-prefix.js +43 -0
  178. package/src/utils/dom.js +74 -0
  179. package/src/utils/find.js +28 -0
  180. package/src/utils/fontFace.js +25 -0
  181. package/src/utils/groupBy.js +12 -0
  182. package/src/utils/index.js +29 -0
  183. package/src/utils/matches.js +11 -0
  184. package/src/utils/mixin.js +5 -0
  185. package/src/utils/object.js +26 -0
  186. package/src/utils/playButton.js +9 -0
  187. package/src/utils/positioning.js +78 -0
  188. package/src/utils/querystring.js +12 -0
  189. package/src/utils/slicing.js +21 -0
  190. package/src/utils/string.js +15 -0
  191. package/src/utils/throttle.js +30 -0
  192. package/src/utils/time.js +77 -0
  193. package/src/utils/type-inference.js +35 -0
  194. package/src/validators/validators-functions.js +48 -0
  195. package/src/validators/validators-types.js +78 -0
  196. package/src/validators/validators.js +110 -0
  197. package/src/video-player.const.js +68 -0
  198. package/src/video-player.js +761 -0
  199. package/src/video-player.utils.js +123 -0
  200. package/test/adaptive-streaming.test.js +38 -0
  201. package/test/ads.test.js +35 -0
  202. package/test/analytics.test.js +111 -0
  203. package/test/api.test.js +111 -0
  204. package/test/autoplay.scroll.test.js +23 -0
  205. package/test/basic-ui.test.js +59 -0
  206. package/test/colors.test.js +58 -0
  207. package/test/components.test.js +21 -0
  208. package/test/custom-error.test.js +24 -0
  209. package/test/fluid.test.js +36 -0
  210. package/test/isValidConfig.test.js +224 -0
  211. package/test/mocks/cloudinary-core-mock.js +0 -0
  212. package/test/mocks/styleMock.js +1 -0
  213. package/test/multiplayer.test.js +25 -0
  214. package/test/playlist.test.js +60 -0
  215. package/test/puppeteer/vp-env.js +19 -0
  216. package/test/recommendations.test.js +38 -0
  217. package/test/title-bar.test.js +28 -0
  218. package/test/ui-conf.test.js +49 -0
  219. package/test/unit/cloudinaryConfig.test.js +22 -0
  220. package/test/unit/cloudinaryUtils.test.js +53 -0
  221. package/test/unit/utils.test.js +27 -0
  222. package/test/unit/videoSource.test.js +454 -0
  223. package/tsconfig.json +15 -0
  224. package/types/video-player-tests.js +12 -0
  225. package/types/video-player-tests.ts +31 -0
  226. package/types/video-player.d.ts +570 -0
@@ -0,0 +1,570 @@
1
+ /* eslint-disable */
2
+ // Type definitions for ../src/video-player.js
3
+ // Project: [LIBRARY_URL_HERE]
4
+ // Definitions by: [YOUR_NAME_HERE] <[YOUR_URL_HERE]>
5
+ // Definitions: https://github.com/borisyankov/DefinitelyTyped
6
+
7
+ import {VideoJsPlayerOptions} from "video.js";
8
+ import {Configuration, Transformation, Cloudinary} from "cloudinary-core"
9
+
10
+ declare module 'cloudinary-core' {
11
+ interface Cloudinary {
12
+ /**
13
+ *
14
+ * @param elem
15
+ * The video element for the player
16
+ * @param options
17
+ * Video player options
18
+ * @param ready
19
+ * Is the player ready to play
20
+ */
21
+ videoPlayer(elem: string, options?: Options, ready?: boolean): VideoPlayer;
22
+ /**
23
+ * create video players from a css class class selector
24
+ * @param {string} selector
25
+ * Class name
26
+ * @param ...args
27
+ * arguments to pass to the video player constructor
28
+ * @return {Array.VideoPlayer}
29
+ * An array of video player objects
30
+ */
31
+ videoPlayers(selector: string, ...args: any): VideoPlayer[];
32
+ }
33
+ }
34
+
35
+ export interface PosterOptions {
36
+ /**
37
+ * @param The public id of the poster
38
+ */
39
+ publicId: string,
40
+ /**
41
+ * @param Cloudinary transformations to apply to the poster
42
+ */
43
+ transformation: Transformation[]
44
+ }
45
+
46
+
47
+ /** @typedef {Object} json
48
+ * @property {Object} ads
49
+ * Enables serving ads in your video player based on leading video ad standards such as VAST, VPAID, and VMAP, including Google DoubleClick or AdSense.
50
+ * @property {Boolean} allowUsageReport
51
+ * Cloudinary can optionally collect aggregated statistics about how the video player is being used.
52
+ * The collected data is used in aggregate form to help us improve future versions of the video player and cannot be used to identify individual video viewers.
53
+ * When true (default), Cloudinary collects data on events performed by the video player
54
+ * @property {Boolean} analytics
55
+ * Whether to activate analytics for video player events. Default: false
56
+ * @property {Boolean} autoplay
57
+ * Whether to apply standard HTML5 autoplay. Default: false.
58
+ * @property {String|Boolean} bigPlayButton
59
+ * Whether to show a larger play button.
60
+ * Possible values:
61
+ * true: Always show big play button.
62
+ * false: Never show big play button.
63
+ * init: Show big play button on initial load only.
64
+ * Default: false
65
+ * @property {Object} colors
66
+ * The colors to use for the player UI. The values must be supplied as hex color codes. You can set:
67
+ * base: The base color for the player's controls and information bars as well as the base color of the central play button.
68
+ * accent: The color for the progress bar and volume level.
69
+ * text: The color for all text and icons.
70
+ * @property {Boolean} controls
71
+ * Whether to display the video player controls
72
+ * @property {Object} floatingWhenNotVisible
73
+ * Whether to display a floating player in the corner of the screen when a video is playing and less than half the player is visible.
74
+ * Possible values:
75
+ * right: Shows floating player in the bottom right of the screen
76
+ * left: Shows floating player in the bottom left of the screen
77
+ * @property {Boolean} fluid
78
+ * Whether to activate fluid layout mode, which dynamically adjusts the player size to fit its container or window.
79
+ * @property {String} fontFace
80
+ * The font to use for text elements in the video player. If not specified, the player loads with the default player font-family: Fira Sans.
81
+ * @property {Boolean} hideContextMenu
82
+ * Whether to hide the context menu that appears when right-clicking on the player. Default: false
83
+ * @property {String} logoImageUrl
84
+ * The URL for the logo image to display in the player's control bar. Relevant only when showLogo is true. Default: Cloudinary logo.
85
+ * @property {String} logoOnclickUrl
86
+ * The URL where the viewer will be sent when clicking the logo in the player control bar. Relevant only when showLogo is true. Default: https://cloudinary.com
87
+ * @property {Array} playbackRates
88
+ * An array of playback rates to display in the control bar. Allows the user to change the speed that the video plays at.
89
+ * @property {Object} playlistWidget
90
+ * Adds a playlist widget to the video player.
91
+ * @property {String} poster
92
+ * The publicId from the poster image
93
+ * @property {Object} posterOptions
94
+ * A default poster that is shown every time a new video loads. It can include transformation settings
95
+ * @property {Boolean} showLogo
96
+ * Whether to show a clickable logo within the player. You can customize the logo image (logoImageUrl) and logo url (logoOnclickUrl) for your own requirements. Default: true
97
+ * @property {String} transformation
98
+ * Default transformation to apply on every source video that plays in the player
99
+ * @property {Object} videoJS
100
+ * Access all underlying capabilities of the VideoJS API
101
+ */
102
+ export interface Options {
103
+ bigPlayButton?: boolean | string,
104
+ colors?: {
105
+ base: string,
106
+ accent: string,
107
+ text: string
108
+ },
109
+ controls?: boolean,
110
+ floatingWhenNotVisible?: string,
111
+ fluid?: boolean,
112
+ autoplay?: boolean,
113
+ fontFace?: string | boolean,
114
+ hideContextMenu?: boolean,
115
+ playbackRates?: string[],
116
+ playlistWidget?: {
117
+ direction?: string,
118
+ total?: number,
119
+ },
120
+ poster?: string,
121
+ posterOptions?: PosterOptions,
122
+ showLogo?: boolean,
123
+ logoImageUrl?: string,
124
+ logoOnclickUrl?: string,
125
+ transformation?: Transformation[],
126
+ ads?: AdsOptions,
127
+ analytics?: boolean,
128
+ allowUsageReport?: boolean,
129
+ videojs?: VideoJsPlayerOptions;
130
+ }
131
+
132
+ /**
133
+ * Video Source options
134
+ * @param preload [options.preload]
135
+ * The type of standard HTML5 video preloading to use. Relevant only when autoplay is false or autoplayMode is never.
136
+ * Possible values:
137
+ * auto: Default. Begin loading the video immediately.
138
+ * metadata: Only load the video metadata.
139
+ * none: Don't load any video data.
140
+ * @param publicId [options.publicId]
141
+ * The Cloudinary Public ID of the video source to use when the player loads.
142
+ * @param sourceTransformation [options.sourceTransformation]
143
+ * Default transformations to apply to a specific source type.
144
+ * @param sourceTypes [options.sourceTypes]
145
+ * The video source types (and optionally the corresponding codecs) that will be available for the player to request (as appropriate for the current browser). If a source type can't be played in the requesting browser, the next source in the array will be tried. Add the codec after the source type and separate with a '/', for example: mp4/h265.
146
+ * For HLS and MPEG-DASH, use the values hls and dash respectively and optionally specify a codec as described above.
147
+ * For audio only, use audio.
148
+ * If you also define a codec as part of a transformation, this will override the source type.
149
+ * Default: ['webm/vp9','mp4/h265','mp4'].
150
+ * The default is configured to be the most optimal combination of source types for modern browsers.
151
+ */
152
+ export interface SourceOptions {
153
+ preload?: string,
154
+ publicId?: string,
155
+ sourceTransformation?: Transformation[],
156
+ sourceTypes?: string[],
157
+ }
158
+ /** @typedef {Object} json
159
+ * @property {String} adLabel
160
+ * Optional. Alternative or translated text for the 'Advertisement' countdown label. Relevant only when showCountdown is true.
161
+ * @property {String} adTagUrl
162
+ * The full URL of the adTag to run
163
+ * @property {String} adsInPlaylist
164
+ * string value setting when to call the adTag
165
+ * first-video: Calls the adTag on the first video in the playlist only.
166
+ * every-video: Calls the adTag on every video in the playlist.
167
+ * default first-video
168
+ * @property {String} locale
169
+ * Optional. Locale for ad localization. Can be any ISO 639-1 (two-letter) or ISO 639-2,(three-letter) locale code.
170
+ * This setting affects the language of relevant elements within the adTag, such as the Skip option. Default: en.
171
+ * @property {Number} postrollTimeout
172
+ * Optional. Maximum time (in milliseconds) to wait for a postroll ad to start.
173
+ * If the ad does not start an adtimeout event is triggered.
174
+ * @property {Number} prerollTimeout
175
+ * Optional. Maximum time (in milliseconds) to wait for a preroll ad to start.
176
+ * If the ad does not start an adtimeout event is triggered.
177
+ * @property {Boolean} showCountdown
178
+ * Optional. When true, the 'Advertisement' countdown label is displayed in small text in the bottom center of the video player
179
+ * along with a counter showing the time (in seconds) until the end of the video. Default: true.
180
+ */
181
+
182
+ export interface AdsOptions {
183
+ adTagUrl: string,
184
+ adsInPlaylist?: string,
185
+ showCountdown?: boolean,
186
+ adLabel?: string
187
+ locale?: string,
188
+ prerollTimeout?: number
189
+ postrollTimeout?: number
190
+
191
+ }
192
+
193
+ export class BaseSource {
194
+ constructor(publicId: any, options?: {});
195
+ publicId: (publicId: string) => BaseSource;
196
+ cloudinaryConfig: (config: {}) => BaseSource;
197
+ resourceConfig: (config: any) => BaseSource;
198
+ transformation: (trans: any) => BaseSource;
199
+ queryParams: (params: any) => BaseSource;
200
+ getType: () => string;
201
+ config(): any;
202
+ url({transformation}?: {
203
+ transformation: any;
204
+ }): string;
205
+ }
206
+
207
+ export interface imaAdPlayer {
208
+ playAd: (adTad: string) => void;
209
+ }
210
+
211
+ export class VideoSource {
212
+ constructor(publicId: any, options?: {});
213
+ _type: string;
214
+ poster: (publicId: string, options?: {}) => VideoSource;
215
+ sourceTypes: (types: Array<string>) => VideoSource;
216
+ sourceTransformation: (trans: any) => VideoSource;
217
+ info: (info: {}) => VideoSource;
218
+ recommendations: (recommends: any) => VideoSource;
219
+ objectId: number;
220
+ }
221
+
222
+ export class ImageSource {
223
+ constructor(publicId: string, options?: {});
224
+
225
+ _type: string;
226
+ }
227
+
228
+ export class Playlist {
229
+ constructor(context: CloudinaryContext, sources?: VideoSource|string[], { repeat, autoAdvance, presentUpcoming }?: {
230
+ repeat?: boolean;
231
+ autoAdvance?: boolean;
232
+ presentUpcoming?: boolean;
233
+ });
234
+ enqueue: (source: VideoSource|string, options?: {}) => VideoSource;
235
+ currentIndex: (index: number) => number;
236
+ presentUpcoming: (delay: number) => number;
237
+ autoAdvance: (delay: number) => number;
238
+ list: () => VideoSource[];
239
+ player: () => VideoPlayer;
240
+ dispose: () => void;
241
+ resetState: () => void;
242
+ playItem(item: VideoSource): VideoSource;
243
+ playAtIndex(index: number): VideoSource;
244
+ currentSource(): VideoSource;
245
+ removeAt(index: number): Playlist;
246
+ repeat(repeat: any): boolean;
247
+ first(): VideoSource;
248
+ last(): VideoSource;
249
+ next(): VideoSource;
250
+ nextIndex(index: VideoSource): number;
251
+ previousIndex(): number;
252
+ playFirst(): VideoSource;
253
+ playLast(): VideoSource;
254
+ isLast(): boolean;
255
+ isFirst(): boolean;
256
+ length(): number;
257
+ playNext(): VideoSource;
258
+ playPrevious(): VideoSource;
259
+ }
260
+
261
+ export class CloudinaryContext {
262
+ constructor(player: VideoPlayer, options?: Options);
263
+ player: VideoPlayer;
264
+ source: (source: VideoSource, options?: SourceOptions) => VideoPlayer;
265
+ buildSource: (publicId: string|SourceOptions, options?: SourceOptions) => VideoPlayer;
266
+ posterOptions: (options: PosterOptions) => VideoPlayer;
267
+ cloudinaryConfig: (config: Configuration) => VideoPlayer;
268
+ transformation: (trans: Transformation[]) => VideoPlayer;
269
+ sourceTypes: (types: string[],) => VideoPlayer;
270
+ getCurrentSources: () => VideoSource[];
271
+ sourceTransformation: (trans: Transformation[]) => VideoPlayer;
272
+ on: (...args: any[]) => any;
273
+ one: (...args: any[]) => any;
274
+ off: (...args: any[]) => any;
275
+ autoShowRecommendations: (autoShow: any) => boolean;
276
+ dispose: () => void;
277
+ currentSourceType(): string;
278
+ currentPublicId(): string;
279
+ currentPoster(): ImageSource;
280
+ }
281
+
282
+ export default class VideoPlayer {
283
+ /**
284
+ *
285
+ * @param elem
286
+ * The video element for the player
287
+ * @param options
288
+ * Video player options
289
+ * @param ready
290
+ * Is the player ready to play
291
+ */
292
+ constructor(elem: string, options: Options, ready: boolean)
293
+
294
+ /**
295
+ *
296
+ * @param config
297
+ * The cloudinary core configurations
298
+ * @return {Object} VideoPlayer class
299
+ */
300
+ cloudinaryConfig(config: Configuration.Options): VideoPlayer;
301
+
302
+ /**
303
+ * @return {String} The current video publicId
304
+ *
305
+ */
306
+ currentPublicId(): string;
307
+
308
+ /**
309
+ * @return {String} The current video url
310
+ */
311
+ currentSourceUrl(): string;
312
+
313
+ /**
314
+ * @return {Object} An ImageSource object of the video poster
315
+ */
316
+ currentPoster(): ImageSource;
317
+
318
+ /**
319
+ *
320
+ * @param {String} publicId
321
+ * The publicId from the video source
322
+ * @param {Object} options
323
+ * The source configuration
324
+ * @return {Object} A video source object
325
+ */
326
+ source(publicId: string, options: SourceOptions): VideoSource;
327
+
328
+ /**
329
+ *
330
+ * @param {Object} options
331
+ * The Configuration for the poster
332
+ * @return {Object} The VideoPlayer object
333
+ */
334
+ posterOptions(options: PosterOptions): VideoPlayer;
335
+
336
+ /**
337
+ *
338
+ * @param {String} name
339
+ * The name of the skin to apply to the video player
340
+ * @return {string}
341
+ * the class prefix of the skin
342
+ */
343
+ skin(name: string): string;
344
+
345
+ /**
346
+ * Create a playlist
347
+ * @param {Array.<Object>} sources
348
+ * A list of sources for the playlist
349
+ *
350
+ * @param {Object} options
351
+ * Options from the playlist sources the options would be added to each source
352
+ * @return {Object} The video player
353
+ */
354
+ playlist(sources: SourceOptions[], options: SourceOptions): VideoPlayer;
355
+
356
+ /**
357
+ * Create a playlist from a cloudinary tag
358
+ * @param {String} tag
359
+ * The tag name to build the playlist from
360
+ * @param {Object} options
361
+ * Options from the playlist sources the options would be added to each source
362
+ * @return {Object} The video player
363
+ */
364
+ playlistByTag(tag: string, options: SourceOptions): VideoPlayer;
365
+
366
+ /**
367
+ * Get an Array ot sources from a cloudinary tag
368
+ * @param {String} tag
369
+ * The tag name to get the sources by
370
+ * @param {Object} options
371
+ * Options to apply to all sources
372
+ * @return An array of sources
373
+ */
374
+ sourcesByTag(tag: string, options: {}): VideoSource[];
375
+
376
+ /**
377
+ * Should the player be responsive
378
+ * @param {boolean} bool
379
+ * @return
380
+ */
381
+ fluid(bool: boolean): boolean | undefined | VideoPlayer;
382
+
383
+ /**
384
+ * Play the video
385
+ * @return {Object} the video player
386
+ */
387
+ play(): VideoPlayer;
388
+
389
+ /**
390
+ * Stop the video
391
+ * @return {Object} the video player
392
+ */
393
+ stop(): VideoPlayer;
394
+
395
+ /**
396
+ * In a playlist play the previous video
397
+ * @return {Object} the video player
398
+ */
399
+ playPrevious(): VideoPlayer;
400
+
401
+ /**
402
+ *
403
+ * In a playlist play the next video
404
+ * @return {Object} the video player
405
+ */
406
+ playNext(): VideoPlayer;
407
+
408
+ /**
409
+ * Apply transformations to the video
410
+ * @param {Array.Transformation} trans
411
+ * An array of transformations to apply
412
+ * @return {Object} the video player
413
+ */
414
+ transformation(trans: Transformation[]): VideoPlayer;
415
+
416
+ /**
417
+ * Set the source types for the video
418
+ * @param {array} types
419
+ * The array of types
420
+ * @return {Object} the video player
421
+ */
422
+ sourceTypes(types: string[]): VideoPlayer;
423
+
424
+ /**
425
+ *
426
+ * Apply transformations to this source
427
+ * @param {Array.Transformation} trans
428
+ * An array of transformations to apply
429
+ * @return {Object} the video player
430
+ */
431
+ sourceTransformation(trans: Transformation[]): VideoPlayer;
432
+
433
+ /**
434
+ * get or set would auto recommendation be shown
435
+ *
436
+ * @param {boolean} autoShow
437
+ * @return {Object} the video player
438
+ */
439
+ autoShowRecommendations(autoShow?: boolean): VideoPlayer;
440
+
441
+ /**
442
+ * Get the video duration
443
+ * @return {number} the video duration
444
+ */
445
+ duration(): number;
446
+
447
+ /**
448
+ * Set the player height
449
+ * @param {number} dimension
450
+ * The height in pixels
451
+ * @return {Object} the video player
452
+ */
453
+ height(dimension: number): VideoPlayer;
454
+
455
+ /**
456
+ * Set the width of the player
457
+ * @param {number} dimension
458
+ * The width in pixels
459
+ * @return {Object} the video player
460
+ */
461
+ width(dimension: number): VideoPlayer;
462
+
463
+ /**
464
+ * Set the player volume
465
+ * @param {number} volume
466
+ * Volume to apply
467
+ * @return {Object} the video player
468
+ */
469
+ volume(volume: number): VideoPlayer;
470
+
471
+ /**
472
+ * Mute the video
473
+ * @return {Object} the video player
474
+ */
475
+ mute(): VideoPlayer;
476
+
477
+ /**
478
+ * Unmute the player
479
+ * @return {Object} the video player
480
+ */
481
+ unmute(): VideoPlayer;
482
+
483
+ /**
484
+ * Is the player muted
485
+ * @return {boolean}
486
+ * true if the player is muted
487
+ */
488
+ isMuted(): boolean;
489
+
490
+ /**
491
+ * Pause the video
492
+ * @return {Object} the video player
493
+ */
494
+ pause(): VideoPlayer;
495
+
496
+ /**
497
+ * Set or get the current video time
498
+ * @param {number} offsetSeconds
499
+ * optional if given the video would seek to that time
500
+ * if non is given would return the current video time
501
+ * @return {object} the video player
502
+ */
503
+ currentTime(offsetSeconds?: number): VideoPlayer|number;
504
+
505
+ /**
506
+ * Enter fullscreen mode
507
+ * @return {object} The video player
508
+ */
509
+ maximize(): VideoPlayer;
510
+
511
+ /**
512
+ * Exit full screen mode
513
+ * @return {object} The video player
514
+ */
515
+ exitMaximize(): VideoPlayer;
516
+
517
+ /**
518
+ * Is the video player is in fullscreen mode
519
+ * @return {boolean}
520
+ */
521
+ isMaximized(): boolean;
522
+
523
+ /**
524
+ * Delete the current video player
525
+ */
526
+ dispose(): void;
527
+
528
+ /**
529
+ * Get or set would the controls be shown
530
+ * @param {boolean} bool
531
+ * if given true to show the controls false to hide
532
+ * if non is given returns the current control status
533
+ * @return {object|Boolean}
534
+ * if the an options is given would return the video player
535
+ * if not the boolean with the current state
536
+ */
537
+ controls(bool?: boolean): VideoPlayer;
538
+
539
+ /**
540
+ * Get the interface to play ads
541
+ * @return {object} interface to play ads
542
+ */
543
+ ima(): imaAdPlayer;
544
+
545
+ /**
546
+ * get or set if the video should automatically restart
547
+ * @param {boolean} bool
548
+ * true to auto restart false not to
549
+ * @return {object|Boolean}
550
+ * if the an options is given would return the video player
551
+ * if not the boolean with the current state
552
+ */
553
+ loop(bool?: boolean): VideoPlayer|boolean;
554
+
555
+ /**
556
+ * Proxy method for videojs el
557
+ */
558
+ el(): Element;
559
+
560
+ /**
561
+ * create video players from a css class class selector
562
+ * @param {string} selector
563
+ * Class name
564
+ * @param ...args
565
+ * arguments to pass to the video player constructor
566
+ * @return {Array.VideoPlayer}
567
+ * An array of video player objects
568
+ */
569
+ static all(selector: string, ...args: any): VideoPlayer[];
570
+ }