@saooti/octopus-sdk 40.2.13 → 40.2.15

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": "40.2.13",
3
+ "version": "40.2.15",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -32,7 +32,8 @@ export const usePlayerLive = (hlsReady: Ref<boolean>)=>{
32
32
  function playRadio() {
33
33
  if (!playerStore.playerRadio) return;
34
34
  handleSessionIdRadio();
35
- playHls(playerStore.playerRadio.url+"?origin=octopus&sessionId="+playerStore.playerRadio.sessionId);
35
+ playerStore.playerUpdatePlayerHlsUrl(playerStore.playerRadio.url+"?origin=octopus&sessionId="+playerStore.playerRadio.sessionId);
36
+ playHls();
36
37
  }
37
38
 
38
39
  function handleSessionIdRadio(){
@@ -45,20 +46,20 @@ export const usePlayerLive = (hlsReady: Ref<boolean>)=>{
45
46
 
46
47
  function playLive() {
47
48
  if (!playerStore.playerLive) return;
48
- const hlsStreamUrl = `${apiStore.hlsUrl}live/dev.${playerStore.playerLive.conferenceId}/index.m3u8`;
49
- playHls(hlsStreamUrl);
49
+ playerStore.playerUpdatePlayerHlsUrl(`${apiStore.hlsUrl}live/dev.${playerStore.playerLive.conferenceId}/index.m3u8`);
50
+ playHls();
50
51
  }
51
52
 
52
- async function playHls(hlsStreamUrl: string): Promise<void> {
53
+ async function playHls(): Promise<void> {
53
54
  try {
54
55
  if(null===audioElement.value){
55
56
  audioElement.value = document.getElementById(
56
57
  "audio-player",
57
58
  ) as HTMLAudioElement;
58
59
  }
59
- if (null === audioElement.value) {
60
+ if (null === audioElement.value || !playerStore.playerHlsUrl) {
60
61
  setTimeout(() => {
61
- playHls(hlsStreamUrl);
62
+ playHls();
62
63
  }, 1000);
63
64
  return;
64
65
  }
@@ -69,33 +70,33 @@ export const usePlayerLive = (hlsReady: Ref<boolean>)=>{
69
70
  !isAndroid
70
71
  ) {
71
72
  if ("SECURED" === playerStore.playerLive?.organisation?.privacy && authStore.authParam.accessToken) {
72
- audioElement.value.src = hlsStreamUrl+"?access_token="+authStore.authParam.accessToken;
73
+ audioElement.value.src = playerStore.playerHlsUrl+"?access_token="+authStore.authParam.accessToken;
73
74
  }else{
74
- audioElement.value.src = hlsStreamUrl;
75
+ audioElement.value.src = playerStore.playerHlsUrl;
75
76
  }
76
77
  await initLiveDownloadId();
77
78
  hlsReady.value = true;
78
79
  await audioElement.value.play();
79
80
  onPlay();
80
81
  } else {
81
- await initHls(hlsStreamUrl);
82
+ await initHls();
82
83
  }
83
84
  } catch {
84
- onHlsError(hlsStreamUrl);
85
+ onHlsError();
85
86
  }
86
87
  }
87
88
 
88
- function onHlsError(hlsStreamUrl:string){
89
+ function onHlsError(){
89
90
  if("STOPPED"!==playerStore.playerStatus && undefined===hlsRetryTimeout.value){
90
91
  hlsRetryTimeout.value = setTimeout(() => {
91
92
  errorHls.value = false;
92
- playHls(hlsStreamUrl);
93
+ playHls();
93
94
  hlsRetryTimeout.value = undefined;
94
95
  }, 5000);
95
96
  }
96
97
  }
97
98
 
98
- async function initHls(hlsStreamUrl: string) {
99
+ async function initHls() {
99
100
  if (null === Hls) {
100
101
  await import("hls.js").then((hlsLibrary) => {
101
102
  Hls = hlsLibrary.default;
@@ -122,17 +123,17 @@ export const usePlayerLive = (hlsReady: Ref<boolean>)=>{
122
123
  playPromise.value = undefined;
123
124
  onPlay();
124
125
  }).catch(()=>{
125
- onHlsError(hlsStreamUrl);
126
+ onHlsError();
126
127
  playPromise.value = undefined;
127
128
  })
128
129
  });
129
130
  hls.value.on(Hls.Events.ERROR, async (e, data:any) => {
130
131
  errorHls.value = true;
131
132
  if(undefined===playPromise.value && data.fatal){
132
- onHlsError(hlsStreamUrl);
133
+ onHlsError();
133
134
  }
134
135
  });
135
- hls.value.loadSource(hlsStreamUrl);
136
+ hls.value.loadSource(playerStore.playerHlsUrl);
136
137
  hls.value.attachMedia(audioElement.value as HTMLAudioElement);
137
138
  }
138
139
 
@@ -8,6 +8,7 @@ export const usePlayerLogicProgress = ()=>{
8
8
  const notListenTime= ref(0);
9
9
  const lastSend= ref(0);
10
10
  const downloadId: Ref<string | null>= ref(null);
11
+ const urlLiveSent= ref(false);
11
12
 
12
13
  const playerStore = usePlayerStore();
13
14
  const authStore = useAuthStore();
@@ -31,11 +32,7 @@ export const usePlayerLogicProgress = ()=>{
31
32
  return;
32
33
  }
33
34
  lastSend.value = newVal;
34
- await classicApi.putData({
35
- api: 0,
36
- path:"podcast/listen/" + downloadId.value + "?seconds=" + Math.round(newVal),
37
- isNotAuth:true
38
- });
35
+ await sendListeningProgress(newVal);
39
36
  });
40
37
 
41
38
  watch(()=>playerStore.playerSeekTime, async () => {
@@ -65,24 +62,16 @@ export const usePlayerLogicProgress = ()=>{
65
62
  }
66
63
  try {
67
64
  const mediaType = playerStore.playerVideo ? "VIDEO":"AUDIO";
68
- const downloadId = await classicApi.putData<string | null>({
69
- api: 0,
70
- path:"podcast/prepare/live/" + playerStore.playerLive.podcastId+"?mediaType="+mediaType,
65
+ const downloadIdFetched = await classicApi.fetchData<string | null>({
66
+ api:0,
67
+ path: "podcast/download/live2/" + playerStore.playerLive.podcastId,
68
+ parameters:{
69
+ mediaType: mediaType,
70
+ origin: "octopus",
71
+ distributorId: authStore.authOrgaId,
72
+ },
71
73
  });
72
- try {
73
- await classicApi.fetchData<string | null>({
74
- api:0,
75
- path: "podcast/download/live/" + playerStore.playerLive.podcastId + ".m3u8",
76
- parameters:{
77
- downloadId: downloadId ?? undefined,
78
- origin: "octopus",
79
- distributorId: authStore.authOrgaId,
80
- },
81
- });
82
- } catch {
83
- // Remove try/catch when back will no longer redirect with a 403 in a secured context #13594
84
- }
85
- setDownloadId(downloadId);
74
+ setDownloadId(downloadIdFetched);
86
75
  } catch {
87
76
  downloadId.value = null;
88
77
  console.log("ERROR downloadId");
@@ -116,22 +105,30 @@ export const usePlayerLogicProgress = ()=>{
116
105
 
117
106
  async function endListeningProgress(): Promise<void> {
118
107
  if (!downloadId.value) return;
108
+ await sendListeningProgress(listenTime.value);
109
+ downloadId.value = null;
110
+ notListenTime.value = 0;
111
+ lastSend.value = 0;
112
+ listenTime.value = 0;
113
+ urlLiveSent.value = false;
114
+ playerStore.playerUpdatePlayerHlsUrl(undefined);
115
+ }
116
+
117
+ async function sendListeningProgress(listenTime:number){
118
+ let paramUrlLive= "";
119
+ if(!urlLiveSent.value && playerStore.playerHlsUrl){
120
+ paramUrlLive="&url="+encodeURI(playerStore.playerHlsUrl);
121
+ urlLiveSent.value = true;
122
+ }
119
123
  try {
120
124
  await classicApi.putData<string | null>({
121
125
  api: 0,
122
- path:"podcast/listen/" +
123
- downloadId.value +
124
- "?seconds=" +
125
- Math.round(listenTime.value),
126
+ path:"podcast/listen/" +downloadId.value +"?seconds=" +Math.round(listenTime)+paramUrlLive,
126
127
  isNotAuth:true
127
128
  });
128
129
  } catch {
129
130
  //Do nothing
130
131
  }
131
- downloadId.value = null;
132
- notListenTime.value = 0;
133
- lastSend.value = 0;
134
- listenTime.value = 0;
135
132
  }
136
133
 
137
134
 
@@ -162,7 +162,7 @@ export default defineComponent({
162
162
  }
163
163
  if(!filterToAdd){return;}
164
164
  const queries = this.returnRubriquesFilter((a) => {
165
- let indexRubriquage = a.findIndex(filter => filter.rubriquageId === filterToAdd.rubriquageId);
165
+ const indexRubriquage = a.findIndex(filter => filter.rubriquageId === filterToAdd.rubriquageId);
166
166
  if (indexRubriquage === -1) {
167
167
  a.push(filterToAdd);
168
168
  } else {
@@ -27,6 +27,7 @@
27
27
  height="20"
28
28
  class="ouest-france-logo"
29
29
  role="presentation"
30
+ title="Ouest France"
30
31
  alt=""
31
32
  src="/img/ouest_france_logo.svg"
32
33
  />
@@ -28,7 +28,7 @@
28
28
  @keydown.enter="clickButton(button.emitName)"
29
29
  >
30
30
  <component :is="button.icon" />
31
- <div class="ms-1">{{ button.title }}</div>
31
+ <span class="ms-1">{{ button.title }}</span>
32
32
  </button>
33
33
  </div>
34
34
  </ClassicPopover>
@@ -15,6 +15,7 @@
15
15
  alt=""
16
16
  width="140"
17
17
  height="50"
18
+ title="Logo"
18
19
  :class="platformEducation ? 'education-logo' : 'octopus-logo'"
19
20
  />
20
21
  <img
@@ -23,6 +24,7 @@
23
24
  role="presentation"
24
25
  alt=""
25
26
  class="client-logo"
27
+ title="Logo"
26
28
  :class="platformEducation ? 'education-logo' : ''"
27
29
  />
28
30
  </router-link>
@@ -46,6 +48,7 @@
46
48
  width="100"
47
49
  height="29"
48
50
  class="ms-2"
51
+ title="Logo"
49
52
  :class="platformEducation ? 'education-logo' : 'octopus-logo'"
50
53
  />
51
54
  <a
@@ -59,6 +62,7 @@
59
62
  :src="logoUrl"
60
63
  role="presentation"
61
64
  alt=""
65
+ title="Saooti"
62
66
  width="100"
63
67
  height="29"
64
68
  class="ms-2"
@@ -91,9 +95,9 @@
91
95
  :title="$t('More')"
92
96
  class="d-flex-column flex-nowrap align-items-center btn-transparent py-2 px-3 text-white"
93
97
  >
94
- <div class="link-hover">
98
+ <span class="link-hover">
95
99
  {{ $t("More") }}
96
- </div>
100
+ </span>
97
101
  <ChevronDownIcon />
98
102
  </button>
99
103
  <ClassicPopover
@@ -30,7 +30,7 @@ export default defineComponent({
30
30
  props: {
31
31
  hlsUrl: { default: "", type: String },
32
32
  responsive: { default: false, type: Boolean },
33
- isSecured: { default: true, type: Boolean }, //TODO
33
+ isSecured: { default: true, type: Boolean },
34
34
  },
35
35
  emits: ["changeValid"],
36
36
 
@@ -75,6 +75,7 @@ export default defineComponent({
75
75
  },
76
76
  },
77
77
  mounted() {
78
+ this.playerUpdatePlayerHlsUrl(this.hlsUrl);
78
79
  this.useVideoSrc =
79
80
  "" !== this.videoElement.canPlayType("application/vnd.apple.mpegurl") &&
80
81
  !navigator.userAgent.includes("Android");
@@ -88,7 +89,7 @@ export default defineComponent({
88
89
  },
89
90
 
90
91
  methods: {
91
- ...mapActions(usePlayerStore, ["playerUpdateSeekTime"]),
92
+ ...mapActions(usePlayerStore, ["playerUpdateSeekTime", "playerUpdatePlayerHlsUrl"]),
92
93
  definedStalledTimeout() {
93
94
  this.isPaused = false;
94
95
  this.stalledTimout = setTimeout(() => {
@@ -177,9 +178,11 @@ export default defineComponent({
177
178
  this.videoElement.onseeking = async () => {
178
179
  this.playerUpdateSeekTime(this.videoElement.currentTime);
179
180
  };
180
- /* if ("SECURED" === playerStore.playerLive?.organisation?.privacy && authStore.authParam.accessToken) {
181
- } */
182
- //TODO
181
+ if (this.isSecured && this.authParam.accessToken) {
182
+ this.videoElement.src = this.hlsUrl + "access_token="+this.authParam.accessToken;
183
+ }else{
184
+ this.videoElement.src = this.hlsUrl;
185
+ }
183
186
  this.videoElement.src = this.hlsUrl;
184
187
  },
185
188
  videoClean(): void {
@@ -8,6 +8,7 @@
8
8
  class="logo-octopus"
9
9
  src="/img/logo_saooti_play_black.webp"
10
10
  role="presentation"
11
+ title="Saooti"
11
12
  alt=""
12
13
  />
13
14
  <h2>{{ $t("You do not have the right to access this page") }}</h2>
@@ -19,6 +20,7 @@
19
20
  src="/img/403.webp"
20
21
  role="presentation"
21
22
  alt=""
23
+ title="403"
22
24
  />
23
25
  </div>
24
26
 
@@ -9,6 +9,7 @@
9
9
  class="ouest-france-logo-tag-page"
10
10
  role="presentation"
11
11
  alt=""
12
+ title="Ouest France"
12
13
  src="/img/ouest_france_logo.svg"
13
14
  />
14
15
  </h1>
@@ -31,6 +31,7 @@ interface PlayerState {
31
31
  playerVideo: boolean;
32
32
  playerChaptering?: Chaptering;
33
33
  playerDelayStitching: number;
34
+ playerHlsUrl?: string;
34
35
  }
35
36
  export const usePlayerStore = defineStore("PlayerStore", {
36
37
  state: (): PlayerState => ({
@@ -248,5 +249,8 @@ export const usePlayerStore = defineStore("PlayerStore", {
248
249
  playerUpdateDelayStitching(delay: number) {
249
250
  this.playerDelayStitching = delay;
250
251
  },
252
+ playerUpdatePlayerHlsUrl(hlsUrl: string|undefined) {
253
+ this.playerHlsUrl = hlsUrl;
254
+ },
251
255
  },
252
256
  });