@saooti/octopus-sdk 30.0.46 → 30.0.47

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 CHANGED
@@ -542,4 +542,5 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
542
542
  * 30.0.43 Resize rubriqueList
543
543
  * 30.0.44 ProgressBar pour le soir
544
544
  * 30.0.45 ProgressBar pour le soir
545
- * 30.0.46 Param pour le soir
545
+ * 30.0.46 Param pour le soir
546
+ * 30.0.47 Live error
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "30.0.46",
3
+ "version": "30.0.47",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -28,7 +28,6 @@
28
28
  class="d-flex align-items-center flex-grow-1 px-5"
29
29
  >
30
30
  <audio
31
- v-if="!live"
32
31
  id="audio-player"
33
32
  :src="!live? audioUrl: undefined"
34
33
  autoplay
@@ -194,6 +193,9 @@ export default defineComponent({
194
193
  commentsLoaded(): void {
195
194
  this.initComments(true);
196
195
  },
196
+ audioUrl(): void{
197
+ this.playerError = false;
198
+ }
197
199
  },
198
200
 
199
201
  mounted() {
@@ -342,47 +344,49 @@ export default defineComponent({
342
344
  this.listenTime = 0;
343
345
  },
344
346
  async initHls(hlsStreamUrl: string): Promise<void> {
345
- if(null === Hls){
346
- //TODO -> Version light min quand ce sera possible
347
- await import('hls.js/dist/hls.js').then((hlsLibrary) => {
348
- Hls = hlsLibrary.default;
349
- })
350
- await import('hls.js').then((hlsLibrary) => {
351
- Hls = hlsLibrary.default;
352
- })
353
- }
354
- if (!Hls.isSupported()) {
355
- throw 'Hls is not supported ! ';
356
- }
357
- const hls = new Hls();
358
- hls.on(Hls.Events.MANIFEST_PARSED, async () => {
359
- if(!this.live){ return; }
360
- let downloadId = null;
361
- try {
362
- downloadId = await octopusApi.requestLiveDownloadId(
363
- this.live.livePodcastId
364
- );
365
- await octopusApi.markPlayingLive(
366
- this.live.livePodcastId,
367
- downloadId,
368
- 'octopus',
369
- this.$store.state.authentication.organisationId
370
- );
371
- this.setDownloadId(downloadId);
372
- } catch (error) {
373
- console.log('ERROR downloadId');
347
+ return new Promise<void>(async(resolve, reject) => {
348
+ if(null === Hls){
349
+ //TODO -> Version light min quand ce sera possible
350
+ await import('hls.js/dist/hls.js').then((hlsLibrary) => {
351
+ Hls = hlsLibrary.default;
352
+ })
353
+ await import('hls.js').then((hlsLibrary) => {
354
+ Hls = hlsLibrary.default;
355
+ })
374
356
  }
375
- this.hlsReady = true;
376
- const audio: HTMLElement|null = document.getElementById('audio-player');
377
- hls.attachMedia((audio as HTMLAudioElement));
378
- await (audio as HTMLAudioElement).play();
379
- this.onPlay();
380
- throw 400;
381
- });
382
- hls.on(Hls.Events.ERROR, async () => {
383
- throw 'There is an error while reading media content';
357
+ if (!Hls.isSupported()) {
358
+ reject('Hls is not supported ! ');
359
+ }
360
+ const hls = new Hls();
361
+ hls.on(Hls.Events.MANIFEST_PARSED, async () => {
362
+ if(!this.live){ return; }
363
+ let downloadId = null;
364
+ try {
365
+ downloadId = await octopusApi.requestLiveDownloadId(
366
+ this.live.livePodcastId
367
+ );
368
+ await octopusApi.markPlayingLive(
369
+ this.live.livePodcastId,
370
+ downloadId,
371
+ 'octopus',
372
+ this.$store.state.authentication.organisationId
373
+ );
374
+ this.setDownloadId(downloadId);
375
+ } catch (error) {
376
+ console.log('ERROR downloadId');
377
+ }
378
+ this.hlsReady = true;
379
+ const audio: HTMLElement|null = document.getElementById('audio-player');
380
+ hls.attachMedia((audio as HTMLAudioElement));
381
+ await (audio as HTMLAudioElement).play();
382
+ this.onPlay();
383
+ resolve();
384
+ });
385
+ hls.on(Hls.Events.ERROR, async() => {
386
+ reject('There is an error while reading media content');
387
+ });
388
+ hls.loadSource(hlsStreamUrl);
384
389
  });
385
- hls.loadSource(hlsStreamUrl);
386
390
  },
387
391
  async playLive(): Promise<void> {
388
392
  if (!this.live) return;
@@ -19,6 +19,7 @@
19
19
  :class="{
20
20
  'saooti-play2-bounty': isPaused,
21
21
  'saooti-pause-bounty': isPlaying,
22
+ 'spinner-border':!isPaused&&!isPlaying
22
23
  }"
23
24
  />
24
25
  </div>