@growth-labs/video 0.2.0 → 0.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growth-labs/video",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -125,6 +125,14 @@ const captionsSrc = showCaptions
125
125
  const fired = new Set<number>()
126
126
 
127
127
  player.addEventListener('play', () => emit('gl:video-play', { videoId }))
128
+ player.addEventListener('pause', () => {
129
+ const p = player as unknown as { currentTime?: number; duration?: number }
130
+ emit('gl:video-pause', {
131
+ videoId,
132
+ currentTime: p.currentTime,
133
+ duration: p.duration,
134
+ })
135
+ })
128
136
  player.addEventListener('ended', () =>
129
137
  emit('gl:video-complete', {
130
138
  videoId,
@@ -134,6 +142,15 @@ const captionsSrc = showCaptions
134
142
  player.addEventListener('error', (e: Event) =>
135
143
  emit('gl:video-error', { videoId, error: String((e as ErrorEvent).message ?? '') }),
136
144
  )
145
+ player.addEventListener('quality-change', (e: Event) => {
146
+ const detail = (e as CustomEvent<{ quality?: { height?: number; bitrate?: number } }>)
147
+ .detail
148
+ emit('gl:video-quality-change', {
149
+ videoId,
150
+ height: detail?.quality?.height,
151
+ bitrate: detail?.quality?.bitrate,
152
+ })
153
+ })
137
154
  player.addEventListener('timeupdate', () => {
138
155
  const p = player as unknown as { currentTime?: number; duration?: number }
139
156
  if (!p.currentTime || !p.duration) return