@saooti/octopus-sdk 31.0.53 → 31.0.55

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
@@ -644,3 +644,5 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
644
644
  * 31.0.51 Newest
645
645
  * 31.0.52 Locale
646
646
  * 31.0.53 Correction playerLogic
647
+ * 31.0.54 Test live ios
648
+ * 31.0.55 Test live ios
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "31.0.53",
3
+ "version": "31.0.55",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -14,6 +14,11 @@ enum ModuleApi {
14
14
  }
15
15
  /* eslint-disable */
16
16
  export default {
17
+ async fetchData<Type>(state: StoreState,moduleName: ModuleApi,wsPath:string, forceRefresh?:boolean): Promise<Type>{
18
+ console.log(state,moduleName,wsPath,forceRefresh);
19
+ const response = await axios.get('/mock');
20
+ return response.data;
21
+ },
17
22
  async postData<Type>(state: StoreState,moduleName: ModuleApi,wsPath:string, elementToCreate: unknown): Promise<Type>{
18
23
  console.log(state,moduleName,wsPath);
19
24
  const response = await axios.post('/mock', elementToCreate, {
@@ -14,6 +14,7 @@ export const playerLive = defineComponent({
14
14
  lastSend: 0 as number,
15
15
  hlsReady: false as boolean,
16
16
  downloadId: null as string|null,
17
+ audioElement: null as HTMLAudioElement|null
17
18
  };
18
19
  },
19
20
  computed: {
@@ -33,14 +34,36 @@ export const playerLive = defineComponent({
33
34
  this.live.conferenceId +
34
35
  '/index.m3u8';
35
36
  try {
36
- await this.initHls(hlsStreamUrl);
37
+ this.audioElement = (document.getElementById('audio-player') as HTMLAudioElement);
38
+ if (this.audioElement && this.audioElement.canPlayType('application/vnd.apple.mpegurl')) {
39
+ this.audioElement.src = hlsStreamUrl;
40
+ await this.initLiveDownloadId();
41
+ await (this.audioElement as HTMLAudioElement).play();
42
+ this.onPlay();
43
+ }else{
44
+ await this.initHls(hlsStreamUrl);
45
+ }
37
46
  } catch (error) {
38
- console.log(error);
39
47
  setTimeout(() => {
40
48
  this.playLive();
41
49
  }, 1000);
42
50
  }
43
51
  },
52
+ async initLiveDownloadId(){
53
+ if(!this.live){ return;}
54
+ let downloadId = null;
55
+ try {
56
+ downloadId = await octopusApi.putDataPublic<string | null>(0, 'podcast/prepare/live/'+this.live.livePodcastId, undefined);
57
+ await octopusApi.fetchDataPublicWithParams<string | null>(0,'podcast/download/live/' + this.live.livePodcastId+".m3u8",{
58
+ 'downloadId': null!==downloadId ? downloadId : undefined,
59
+ 'origin':'octopus',
60
+ 'distributorId':this.$store.state.authentication.organisationId
61
+ });
62
+ this.setDownloadId(downloadId);
63
+ } catch (error) {
64
+ console.log('ERROR downloadId');
65
+ }
66
+ },
44
67
  async initHls(hlsStreamUrl: string): Promise<void> {
45
68
  return new Promise<void>(async(resolve, reject) => {
46
69
  if(null === Hls){
@@ -55,7 +78,7 @@ export const playerLive = defineComponent({
55
78
  if (!Hls.isSupported()) {
56
79
  reject('Hls is not supported ! ');
57
80
  }
58
- let hls = new Hls();
81
+ const hls = new Hls();
59
82
  /* if(this.$store.state.authentication.isAuthenticated && this.$store.state.oAuthParam.accessToken){
60
83
  hls = new Hls({xhrSetup:
61
84
  (xhr: XMLHttpRequest) => {
@@ -65,23 +88,10 @@ export const playerLive = defineComponent({
65
88
  );
66
89
  } */
67
90
  hls.on(Hls.Events.MANIFEST_PARSED, async () => {
68
- if(!this.live){ return; }
69
- let downloadId = null;
70
- try {
71
- downloadId = await octopusApi.putDataPublic<string | null>(0, 'podcast/prepare/live/'+this.live.livePodcastId, undefined);
72
- await octopusApi.fetchDataPublicWithParams<string | null>(0,'podcast/download/live/' + this.live.livePodcastId+".m3u8",{
73
- 'downloadId': null!==downloadId ? downloadId : undefined,
74
- 'origin':'octopus',
75
- 'distributorId':this.$store.state.authentication.organisationId
76
- });
77
- this.setDownloadId(downloadId);
78
- } catch (error) {
79
- console.log('ERROR downloadId');
80
- }
91
+ await this.initLiveDownloadId();
81
92
  this.hlsReady = true;
82
- const audio: HTMLElement|null = document.getElementById('audio-player');
83
- hls.attachMedia((audio as HTMLAudioElement));
84
- await (audio as HTMLAudioElement).play();
93
+ hls.attachMedia((this.audioElement as HTMLAudioElement));
94
+ await (this.audioElement as HTMLAudioElement).play();
85
95
  this.onPlay();
86
96
  resolve();
87
97
  });
@@ -63,10 +63,12 @@ export const playerLogic = defineComponent({
63
63
  },
64
64
  live: {
65
65
  deep: true,
66
- async handler(){
67
- this.hlsReady = false;
68
- this.reInitPlayer();
69
- await this.playLive();
66
+ handler(){
67
+ this.$nextTick(async () => {
68
+ this.hlsReady = false;
69
+ this.reInitPlayer();
70
+ await this.playLive();
71
+ });
70
72
  }
71
73
  },
72
74
  async listenTime(newVal): Promise<void> {
@@ -3,7 +3,7 @@ import { Category } from './class/general/category';
3
3
 
4
4
  const state:paramStore = {
5
5
  generalParameters: {
6
- organisationId:'ecbd98d9-79bd-4312-ad5e-fc7c1c4a191c',
6
+ organisationId:'0c599ef4-7bf3-4a76-b7ef-4ed7e4d5cd89',
7
7
  authenticated: true,
8
8
  isAdmin: true,
9
9
  isRoleLive: true,
@@ -12,7 +12,7 @@ const state:paramStore = {
12
12
  isPlaylist: false,
13
13
  isProduction: true,
14
14
  isContribution: true,
15
- ApiUri: 'https://api.dev2.saooti.org/',
15
+ ApiUri: 'https://api.preprod.saooti.org/',
16
16
  podcastmaker: false,
17
17
  buttonPlus: true,
18
18
  allCategories: [],
@@ -26,9 +26,9 @@ const state:paramStore = {
26
26
  SharePlayer: true,
27
27
  ShareButtons: true,
28
28
  ShareDistribution: true,
29
- MiniplayerUri: 'https://playerbeta.dev2.saooti.org/',
29
+ MiniplayerUri: 'https://playerbeta.preprod.saooti.org/',
30
30
  downloadButton: false,
31
- hlsUri: 'https://hls.dev2.saooti.org/',
31
+ hlsUri: 'https://hls.preprod.saooti.org/',
32
32
  mainRubrique: 0,
33
33
  resourceUrl: undefined,
34
34
  podcastItemShowEmission: false,
@@ -83,10 +83,10 @@ const state:paramStore = {
83
83
  userName: '',
84
84
  },
85
85
  octopusApi: {
86
- url: 'http://api.dev2.saooti.org/',
87
- commentsUrl: 'http://comments.dev2.saooti.org/',
88
- studioUrl: 'http://studio.dev2.saooti.org/',
89
- playerUrl: 'https://playerbeta.dev2.saooti.org/',
86
+ url: 'http://api.preprod.saooti.org/',
87
+ commentsUrl: 'http://comments.preprod.saooti.org/',
88
+ studioUrl: 'http://studio.preprod.saooti.org/',
89
+ playerUrl: 'https://playerbeta.preprod.saooti.org/',
90
90
  organisationId: undefined,
91
91
  rubriqueIdFilter: undefined,
92
92
  },