@mindedge/vuetify-player 0.1.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/LICENSE.md +11 -0
- package/README.md +275 -0
- package/dist/VuetifyPlayer.common.js +24089 -0
- package/dist/VuetifyPlayer.common.js.map +1 -0
- package/dist/VuetifyPlayer.umd.js +24109 -0
- package/dist/VuetifyPlayer.umd.js.map +1 -0
- package/dist/VuetifyPlayer.umd.min.js +2 -0
- package/dist/VuetifyPlayer.umd.min.js.map +1 -0
- package/dist/demo.html +1 -0
- package/package.json +91 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## License
|
|
2
|
+
|
|
3
|
+
### MIT License
|
|
4
|
+
|
|
5
|
+
Copyright 2022 MindEdge, Inc
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
+
|
|
9
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
# Vuetify-Player
|
|
2
|
+
|
|
3
|
+
An accessible, localized, full featured media player with Vuetifyjs
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Quick Start](#quick-start)
|
|
8
|
+
- [View demos locally](#local-project-setup-to-view-demos)
|
|
9
|
+
- [Complete media source structure](#full-media-src-structure)
|
|
10
|
+
- [Define a media source](#the-src-attribute)
|
|
11
|
+
- [Define a playlist](#the-playlist-attribute)
|
|
12
|
+
- [Define ads / preroll / postroll](#the-ads-array)
|
|
13
|
+
- [Supported Attributes](#supported-vuetifyplayer-attributes)
|
|
14
|
+
- [Supported Events](#supported-vuetifyplayer-events)
|
|
15
|
+
- [License](#license)
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
**Supported File Types:**
|
|
20
|
+
|
|
21
|
+
| Video | Audio | Poster Image |
|
|
22
|
+
| ----------- | ----- | ---------------- |
|
|
23
|
+
| mp4 | mp3 | png |
|
|
24
|
+
| webm | wav | jpg |
|
|
25
|
+
| ogg | ogg | gif (+ animated) |
|
|
26
|
+
| YouTube URL | | |
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
### 1. Install
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
npm install @mindedge/vuetify-player
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 2. Import
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
import VuetifyPlayer from '@mindedge/vuetify-player'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 3. Insert tag
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<VuetifyPlayer :src="src" />
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 4. Define your `src`
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
src: {
|
|
52
|
+
sources: [
|
|
53
|
+
{
|
|
54
|
+
src: "https://cdn.example.com/some-video.mp4",
|
|
55
|
+
type: "video/mp4",
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 4. Enjoy~
|
|
62
|
+
|
|
63
|
+
## Local project setup to view demos
|
|
64
|
+
|
|
65
|
+
Clone the repo
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/mindedge/vuetify-player.git
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Install necessary packages
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Compile and serve. This also hot-reloads for development & testing
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm run serve
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Full media `src` structure
|
|
84
|
+
|
|
85
|
+
```javascript
|
|
86
|
+
{
|
|
87
|
+
name: "", // The video name. Used on playlists
|
|
88
|
+
poster: "", // A video specific poster. Overrides poster attribute
|
|
89
|
+
ads: [
|
|
90
|
+
{
|
|
91
|
+
play_at_percent: 0,
|
|
92
|
+
sources: [
|
|
93
|
+
{
|
|
94
|
+
src: "https://domain.test/ad_example.mp4",
|
|
95
|
+
type: "video/mp4",
|
|
96
|
+
},
|
|
97
|
+
// You can define additional fallback sources here
|
|
98
|
+
],
|
|
99
|
+
tracks: [
|
|
100
|
+
{
|
|
101
|
+
src: "https://domain.test/ad_example_en-US.vtt",
|
|
102
|
+
kind: "captions",
|
|
103
|
+
srclang: "en-US",
|
|
104
|
+
default: true,
|
|
105
|
+
},
|
|
106
|
+
// You can define additional language tracks here
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
sources: [
|
|
111
|
+
{
|
|
112
|
+
src: "https://domain.test/example.mp4",
|
|
113
|
+
type: "video/mp4",
|
|
114
|
+
},
|
|
115
|
+
// You can define additional fallback sources here
|
|
116
|
+
],
|
|
117
|
+
tracks: [
|
|
118
|
+
{
|
|
119
|
+
src: "https://domain.test/example_en-US.vtt",
|
|
120
|
+
kind: "captions",
|
|
121
|
+
srclang: "en-US",
|
|
122
|
+
default: true,
|
|
123
|
+
},
|
|
124
|
+
// You can define additional language tracks here
|
|
125
|
+
],
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## The `src` attribute
|
|
130
|
+
|
|
131
|
+
### The bare minimum,
|
|
132
|
+
|
|
133
|
+
```javascript
|
|
134
|
+
src: {
|
|
135
|
+
sources: [
|
|
136
|
+
{
|
|
137
|
+
src: "https://cdn3-d.mindedgeonline.com/videos/how-we-help-video.mp4",
|
|
138
|
+
type: "video/mp4",
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
```html
|
|
145
|
+
<VuetifyPlayer :src="src" />
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
See [Full media `src` structure](#full-media-src-structure)
|
|
149
|
+
|
|
150
|
+
## The `playlist` attribute
|
|
151
|
+
|
|
152
|
+
This accepts an array of media sources to play in a playlist format.
|
|
153
|
+
Eg:
|
|
154
|
+
|
|
155
|
+
```javascript
|
|
156
|
+
playlist: [
|
|
157
|
+
{ sources: [{ src: "first.mp4", type: "..."}], tracks: [...] },
|
|
158
|
+
{ name: "", sources: [{ src: "second.mp4", type: "..."}], tracks: [...] },
|
|
159
|
+
{ poster: "", sources: [{ src: "third.mp4", type: "..."}], tracks: [...] },
|
|
160
|
+
// Additional media source objects
|
|
161
|
+
]
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
```html
|
|
165
|
+
<VuetifyPlayer :playlist="playlist" />
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
When passing this attribute a playlist menu will appear and media will auto-advance from one source to the next on completion. Both of these can be adjusted with `playlistmenu` and `playlistautoadvance`. See [Supported `<VuetifyPlayer>` Attributes ](#supported-mediaplay-attributes) for more information
|
|
169
|
+
|
|
170
|
+
For more informationm about media sources see [Full media `src` structure](#full-media-src-structure)
|
|
171
|
+
|
|
172
|
+
## The `ads` array
|
|
173
|
+
|
|
174
|
+
The `<VuetifyPlayer>` supports video injection via the ads array. This can be used to inject any other media source at any time during playback.
|
|
175
|
+
|
|
176
|
+
For example:
|
|
177
|
+
|
|
178
|
+
- For preroll set `play_at_percent` to `0`
|
|
179
|
+
- For midroll set `play_at_percent` to `50`
|
|
180
|
+
- For postroll set `play_at_percent` to `100`
|
|
181
|
+
|
|
182
|
+
For multiple ads simply define multiple objects in the ads array.
|
|
183
|
+
|
|
184
|
+
```javascript
|
|
185
|
+
ads: [
|
|
186
|
+
{
|
|
187
|
+
play_at_percent: 0,
|
|
188
|
+
sources: [
|
|
189
|
+
{
|
|
190
|
+
src: 'https://domain.test/ad1_example.mp4',
|
|
191
|
+
type: 'video/mp4',
|
|
192
|
+
},
|
|
193
|
+
// You can define additional fallback sources here
|
|
194
|
+
],
|
|
195
|
+
tracks: [
|
|
196
|
+
{
|
|
197
|
+
src: 'https://domain.test/ad1_example_en-US.vtt',
|
|
198
|
+
kind: 'captions',
|
|
199
|
+
srclang: 'en-US',
|
|
200
|
+
default: true,
|
|
201
|
+
},
|
|
202
|
+
// You can define additional language tracks here
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
// You add additional ad objects here
|
|
206
|
+
]
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
See [Full media `src` structure for where the ads array is placed](#full-media-src-structure)
|
|
210
|
+
|
|
211
|
+
## Supported `<VuetifyPlayer>` Attributes
|
|
212
|
+
|
|
213
|
+
| Attribute Name | Datatype | Allowed Values | Default | Description |
|
|
214
|
+
| ------------------------- | --------- | -------------------------------------------------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
215
|
+
| `language` | `String` | en-US \| See BCP 47 Spec | "en-US" | Defines which locale the video player controls will load in |
|
|
216
|
+
| `src` | `Object` | See [src attribute](#the-src-attribute) | {} | A single media source |
|
|
217
|
+
| `playlist` | `Array ` | See [playlist attribute](#the-playlist-attribute) | [] | A collection of media source(s) |
|
|
218
|
+
| `type` | `String` | video \| audio \| image | "video" | In audio mode the player has a max-height of 40px |
|
|
219
|
+
| `autoplay` | `Boolean` | true \| false | false | Autoplay on load. It's in the spec but DON'T USE THIS |
|
|
220
|
+
| `autopictureinpicture` | `Boolean` | true \| false | false | Start with picture in picture mode |
|
|
221
|
+
| `controls` | `Boolean` | true \| false | true | Show video controls. When false only play/pause allowed but clicking on the video itself |
|
|
222
|
+
| `controlslist` | `String` | nodownload nofullscreen noremoteplayback | "nodownload noremoteplayback" | Space separated string per <video>. Allowed 'nodownload nofullscreen noremoteplayback' |
|
|
223
|
+
| `crossorigin` | `String` | anonymous \| use-credentials | "anonymous" | Indicates whether to use CORS to fetch the related video |
|
|
224
|
+
| `disablepictureinpicture` | `Boolean` | true \| false | true | Shows the picture in picture button |
|
|
225
|
+
| `disableremoteplayback` | `Boolean` | true \| false | true | Shows the remote playback button but functionality does not exist when clicked |
|
|
226
|
+
| `height` | `String` | `css pixel value` | "auto" | The players height |
|
|
227
|
+
| `width` | `String` | `css pixel value` | "100%" | The players width |
|
|
228
|
+
| `rewind` | `Boolean` | true \| false | true | Enabled the rewind 10s button |
|
|
229
|
+
| `loop` | `Boolean` | true \| false | false | Loop the video on completion |
|
|
230
|
+
| `muted` | `Boolean` | true \| false | false | Start the video muted |
|
|
231
|
+
| `playsinline` | `Boolean` | true \| false | false | Force inline & disable fullscreen |
|
|
232
|
+
| `poster` | `String` | `image url` | "" | Overridden with the playlist.poster if one is set there |
|
|
233
|
+
| `preload` | `String` | "none" \| "metadata" \| "auto" \| `_empty string_` | "" | Empty string = `auto` Provide a hint to the browser about what the author thinks will lead to the best user experience with regards to what content is loaded before the video is played. |
|
|
234
|
+
| `captionsmenu` | `Boolean` | true \| false | true | Show the captions below the video |
|
|
235
|
+
| `playlistmenu` | `Boolean` | true \| false | true | Show the playlist menu if there's multiple videos |
|
|
236
|
+
| `playlistautoadvance` | `Boolean` | true \| false | true | Play the next source group |
|
|
237
|
+
| `playbackrates` | `Array` | [`array of numbers`] | [0.5, 1, 1.5, 2] | Default playback speeds. Anything below 0.25 and above 4 will make cause audio distortion |
|
|
238
|
+
|
|
239
|
+
## Supported `<VuetifyPlayer>` Events
|
|
240
|
+
|
|
241
|
+
| Event name | Returns | When it's triggered |
|
|
242
|
+
| ------------------------ | ----------------- | -------------------------------------------------------------------------------------------------------- |
|
|
243
|
+
| `abort` | `Event` | Download interrupted |
|
|
244
|
+
| `canplay` | `Event` | Playback can start |
|
|
245
|
+
| `canplaythrough` | `Event` | Playback can continue and should not be interrupted. Readstate is 3 |
|
|
246
|
+
| `emptied` | `Event` | The network connection is down |
|
|
247
|
+
| `ended` | `Event` | When playback has stopped because the end of the media was reached |
|
|
248
|
+
| `error` | `Event` | A network error occurred during the download |
|
|
249
|
+
| `loadeddata` | `Event` | When the frame at the current playback position of the media has finished loading; often the first frame |
|
|
250
|
+
| `loadedmetadata` | `Event` | When the metadata has been loaded |
|
|
251
|
+
| `play` | `Event` | The media has received a request to start playing |
|
|
252
|
+
| `pause` | `Event` | Playback has been suspended |
|
|
253
|
+
| `progress` | `Event` | The progress event is fired periodically as the browser loads a resource. |
|
|
254
|
+
| `seeking` | `Event` | Playback has moved to a new location |
|
|
255
|
+
| `timeupdate` | `Object` | The current time was changed. Object contains { event: Event, current_percent: Number } |
|
|
256
|
+
| `ratechange` | `Number` | The playback speed multiplier |
|
|
257
|
+
| `stalled` | `Event` | The browser tried to download but has not received data yet |
|
|
258
|
+
| `volumechange` | `Number` | The volume or muted button changed. Value from 0.0 to 1 |
|
|
259
|
+
| `waiting` | `Event` | Pause playback to download more data |
|
|
260
|
+
| `click:fullscreen` | `true` \| `false` | When the fullscreen button is clicked. true on fullscreen, false on exiting fullscreen |
|
|
261
|
+
| `click:pictureinpicture` | `true` \| `false` | When the picture-in-picture button is clicked. true on enabled, false on disabled |
|
|
262
|
+
| `mouseover` | `MouseEvent` | Mouse over the media |
|
|
263
|
+
| `mouseout` | `MouseEvent` | Mouse left the media |
|
|
264
|
+
|
|
265
|
+
## License
|
|
266
|
+
|
|
267
|
+
### MIT License
|
|
268
|
+
|
|
269
|
+
Copyright 2022 MindEdge, Inc
|
|
270
|
+
|
|
271
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
272
|
+
|
|
273
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
274
|
+
|
|
275
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|