@grfzhl/vue-hls-player 1.1.0 → 1.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.
@@ -148,7 +148,7 @@ const hideInitialPlayButton = ref(false)
148
148
  const link = toRef(props, 'link');
149
149
  const previewImageLink = toRef(props, 'previewImageLink');
150
150
  let currentTime = 0
151
- let hls = new Hls()
151
+ let hls = null
152
152
 
153
153
  const videoElement = defineModel()
154
154
 
@@ -259,6 +259,7 @@ watch([props, videoElement], (a) => {
259
259
 
260
260
  watch(link, (newLink, oldLink) => {
261
261
  if (newLink !== oldLink) {
262
+ console.log("prepare new src " + newLink)
262
263
  prepareVideoPlayer();
263
264
  }
264
265
  })
@@ -364,11 +365,15 @@ function seekVideo(time) {
364
365
  }
365
366
 
366
367
  function prepareVideoPlayer() {
367
- let stream = props.link
368
- hls.loadSource(stream)
369
- hls.attachMedia(video.value)
370
-
371
368
  if (video.value) {
369
+ if (hls) {
370
+ hls.destroy();
371
+ }
372
+ hls = new Hls();
373
+ let stream = props.link
374
+ hls.loadSource(stream)
375
+ hls.attachMedia(video.value)
376
+
372
377
  hls.attachMedia(video.value)
373
378
  video.value.muted = props.isMuted
374
379
  video.value.currentTime = props.progress
@@ -207,11 +207,13 @@ function isTxtCueActive(txtCue) {
207
207
  * @param txtIndex
208
208
  */
209
209
  function isWordActive(txtCue, word, wordIndex, txtIndex) {
210
+ console.log("check word active ", txtCue, word, wordIndex, txtIndex)
210
211
  if(!currentCue.value || !word || !txtCue) {
211
212
  return false
212
213
  }
213
214
  const startPos = txtCue.dialog[0].text.indexOf(currentCue.value)
214
215
  const endPos = startPos + currentCue.value.length
216
+ console.log("can word marked", startPos, endPos, wordIndex)
215
217
  if(wordIndex >= startPos && wordIndex < endPos) {
216
218
  return true;
217
219
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@grfzhl/vue-hls-player",
3
3
  "private": false,
4
- "version": "1.1.0",
4
+ "version": "1.1.1",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"