@saooti/octopus-sdk 31.0.57 → 31.0.59

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": "@saooti/octopus-sdk",
3
- "version": "31.0.57",
3
+ "version": "31.0.59",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -41,8 +41,6 @@ export const playerLive = defineComponent({
41
41
  }, 1000);
42
42
  return;
43
43
  }
44
- console.log(this.audioElement);
45
- console.log(this.audioElement.canPlayType('application/vnd.apple.mpegurl'));
46
44
  if (this.audioElement.canPlayType('application/vnd.apple.mpegurl')) {
47
45
  this.audioElement.src = hlsStreamUrl;
48
46
  await this.initLiveDownloadId();
@@ -71,6 +69,7 @@ export const playerLive = defineComponent({
71
69
  } catch (error) {
72
70
  console.log('ERROR downloadId');
73
71
  }
72
+ this.hlsReady = true;
74
73
  },
75
74
  async initHls(hlsStreamUrl: string): Promise<void> {
76
75
  return new Promise<void>(async(resolve, reject) => {
@@ -97,7 +96,6 @@ export const playerLive = defineComponent({
97
96
  } */
98
97
  hls.on(Hls.Events.MANIFEST_PARSED, async () => {
99
98
  await this.initLiveDownloadId();
100
- this.hlsReady = true;
101
99
  hls.attachMedia((this.audioElement as HTMLAudioElement));
102
100
  await (this.audioElement as HTMLAudioElement).play();
103
101
  this.onPlay();
@@ -190,7 +190,15 @@ export const playerLogic = defineComponent({
190
190
  mediaTarget.currentTime - this.notListenTime;
191
191
  }
192
192
  }
193
- const streamDuration = mediaTarget.duration;
193
+ let streamDuration = mediaTarget.duration;
194
+ if(Infinity===streamDuration){
195
+ const seekable = mediaTarget.seekable;
196
+ if(seekable){
197
+ streamDuration = seekable.end(seekable.length - 1);
198
+ }else{
199
+ streamDuration = mediaTarget.currentTime;
200
+ }
201
+ }
194
202
  if (!streamDuration) return;
195
203
  if (!mediaTarget.currentTime) return;
196
204
  if (!this.live) {