@latest-thinking/lt-player 1.0.9-e → 1.1.0
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/ README.md +144 -0
- package/package.json +1 -1
package/ README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Title
|
|
2
|
+
____
|
|
3
|
+
# Features
|
|
4
|
+
|
|
5
|
+
# Quick setup
|
|
6
|
+
|
|
7
|
+
## HTML
|
|
8
|
+
|
|
9
|
+
Player extends upon the standard [HTML5 media element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement) markup so that's all you need for those types.
|
|
10
|
+
|
|
11
|
+
### HTML5 Video
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<div class="lt-player"
|
|
15
|
+
data-lt-player-config='{config}'>
|
|
16
|
+
</div>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Note**: It is mandatory to add the class with the name "lt-player", to be instantiated by the Player Manager and data-lt-player-config = {config object}
|
|
20
|
+
|
|
21
|
+
## JavaScript
|
|
22
|
+
|
|
23
|
+
```html
|
|
24
|
+
<div class="lt-player"
|
|
25
|
+
data-lt-player-config='{config}'>
|
|
26
|
+
</div>
|
|
27
|
+
<script>
|
|
28
|
+
window.addEventListener('load', () => {
|
|
29
|
+
const player = Player.initByClassOrID('lt-player').then(player => {
|
|
30
|
+
return player;
|
|
31
|
+
});
|
|
32
|
+
})
|
|
33
|
+
</script>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
You can use initByClassOrID method, to instantiate player by string name. Mandatory data-lt-player-config={config object}
|
|
37
|
+
|
|
38
|
+
...OR...
|
|
39
|
+
|
|
40
|
+
You can use initBySelector method, to instantiate player by HTMLElement. Mandatory data-lt-player-config={config object}
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<div class="lt-player">
|
|
44
|
+
</div>
|
|
45
|
+
<script>
|
|
46
|
+
window.addEventListener('load', () => {
|
|
47
|
+
let selector = document.querySelector('lt-player');
|
|
48
|
+
|
|
49
|
+
const player = Player.initBySelector(selector).then(player => {
|
|
50
|
+
return player;
|
|
51
|
+
});
|
|
52
|
+
})
|
|
53
|
+
</script>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
You can instantiate multiple player by HTMLElement. Mandatory data-lt-player-config={config object}
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<div class="lt-player">
|
|
60
|
+
</div>
|
|
61
|
+
<div class="lt-player">
|
|
62
|
+
</div>
|
|
63
|
+
<div class="lt-player">
|
|
64
|
+
</div>
|
|
65
|
+
<div class="lt-player">
|
|
66
|
+
</div>
|
|
67
|
+
<script>
|
|
68
|
+
window.addEventListener('load', () => {
|
|
69
|
+
let selectors = document.querySelectorAll('lt-player');
|
|
70
|
+
|
|
71
|
+
selectors.forEach(item => {
|
|
72
|
+
Player.initBySelector(item).then(player => {
|
|
73
|
+
console.log(player)
|
|
74
|
+
});
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
</script>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
You can instantiate by javascript object config. See examples:
|
|
81
|
+
```html
|
|
82
|
+
<div class="lt-player">
|
|
83
|
+
</div>
|
|
84
|
+
<script>
|
|
85
|
+
window.addEventListener('load', () => {
|
|
86
|
+
|
|
87
|
+
const objectConfig =
|
|
88
|
+
{
|
|
89
|
+
version: "2",
|
|
90
|
+
body: {
|
|
91
|
+
playerContainer: 'lt-player' //mandatory
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const player = Player.initPlayer(objectConfig).then(player => {
|
|
96
|
+
return player;
|
|
97
|
+
});
|
|
98
|
+
})
|
|
99
|
+
</script>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
```html
|
|
103
|
+
<div class="lt-player">
|
|
104
|
+
</div>
|
|
105
|
+
<script>
|
|
106
|
+
window.addEventListener('load', () => {
|
|
107
|
+
|
|
108
|
+
const objectConfig =
|
|
109
|
+
{
|
|
110
|
+
version: "2",
|
|
111
|
+
body: {
|
|
112
|
+
playerContainer: 'lt-player' //mandatory
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const selector = document.querySelector('lt-player');
|
|
116
|
+
|
|
117
|
+
const player = Player.initBySelector(selector, objectConfig).then(player => {
|
|
118
|
+
return player;
|
|
119
|
+
});
|
|
120
|
+
})
|
|
121
|
+
</script>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```html
|
|
125
|
+
<div class="lt-player">
|
|
126
|
+
</div>
|
|
127
|
+
<script>
|
|
128
|
+
window.addEventListener('load', () => {
|
|
129
|
+
|
|
130
|
+
const objectConfig =
|
|
131
|
+
{
|
|
132
|
+
version: "2",
|
|
133
|
+
body: {
|
|
134
|
+
playerContainer: 'lt-player' //mandatory
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const player = Player.initByClassOrID('lt-player', objectConfig).then(player => {
|
|
139
|
+
return player;
|
|
140
|
+
});
|
|
141
|
+
})
|
|
142
|
+
</script>
|
|
143
|
+
```
|
|
144
|
+
|