@saooti/octopus-sdk 30.0.77 → 30.0.80

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
@@ -573,4 +573,7 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
573
573
  * 30.0.74 Error locales en allemand (je sens que ça va être fun cette histoire)
574
574
  * 30.0.75 Parlement
575
575
  * 30.0.76 Space
576
- * 30.0.77 V-Calendar bloque version
576
+ * 30.0.77 V-Calendar bloque version
577
+ * 30.0.78 a -> word-break
578
+ * 30.0.79 DownloadId player
579
+ * 30.0.80 DownloadId player
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "30.0.77",
3
+ "version": "30.0.80",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -15,7 +15,7 @@
15
15
  "main": "./dist/octopus.common.js",
16
16
  "dependencies": {
17
17
  "@popperjs/core": "^2.11.0",
18
- "@saooti/octopus-api": "^0.30.4",
18
+ "@saooti/octopus-api": "^0.30.5",
19
19
  "@vue/cli": "^5.0.0-rc.1",
20
20
  "@vue/compat": "^3.2.26",
21
21
  "axios": "^0.24.0",
@@ -13,6 +13,9 @@ body{
13
13
  overscroll-behavior-y: contain;
14
14
  }
15
15
  .octopus-app{
16
+ a{
17
+ word-break: break-word;
18
+ }
16
19
  h1{
17
20
  margin-bottom: 2rem;
18
21
  }
@@ -29,7 +29,7 @@
29
29
  >
30
30
  <audio
31
31
  id="audio-player"
32
- :src="!live? audioUrl: undefined"
32
+ :src="!live? audioUrlToPlay: undefined"
33
33
  autoplay
34
34
  @timeupdate="onTimeUpdate"
35
35
  @ended="onFinished"
@@ -108,6 +108,7 @@ export default defineComponent({
108
108
  hlsReady: false as boolean,
109
109
  comments: [] as Array<CommentPodcast>,
110
110
  showTimeline: false as boolean,
111
+ audioUrlToPlay: "" as string
111
112
  };
112
113
  },
113
114
  computed: {
@@ -141,7 +142,6 @@ export default defineComponent({
141
142
  if (this.listenError) return this.podcast.audioStorageUrl;
142
143
  const parameters = [];
143
144
  parameters.push('origin=octopus');
144
- parameters.push('cookieName=player_' + this.podcast.podcastId);
145
145
  parameters.push('listenerId='+this.getListenerId());
146
146
  if (
147
147
  this.$store.state.authentication &&
@@ -151,7 +151,7 @@ export default defineComponent({
151
151
  'distributorId=' + this.$store.state.authentication.organisationId
152
152
  );
153
153
  }
154
- return this.podcast.audioUrl + '?' + parameters.join('&');
154
+ return this.podcast.podcastId+'.mp3?' + parameters.join('&');
155
155
  },
156
156
  organisationId(): string|undefined {
157
157
  return state.generalParameters.organisationId;
@@ -190,6 +190,7 @@ export default defineComponent({
190
190
  }
191
191
  },
192
192
  async listenTime(newVal): Promise<void> {
193
+ console.log(this.lastSend, newVal);
193
194
  if ((!this.podcast && !this.live)||(!this.getDownloadId())||(newVal - this.lastSend < 10)) {
194
195
  return;
195
196
  }
@@ -202,8 +203,15 @@ export default defineComponent({
202
203
  commentsLoaded(): void {
203
204
  this.initComments(true);
204
205
  },
205
- audioUrl(): void{
206
+ async audioUrl(): Promise<void>{
206
207
  this.playerError = false;
208
+ if(this.media || !this.podcast || !this.podcast.availability.visibility ||this.listenError){
209
+ this.audioUrlToPlay = this.audioUrl;
210
+ }
211
+ if(!this.podcast){return;}
212
+ const response = await octopusApi.fetchPodcastDownloadUrl("podcast/download/register/"+ this.audioUrl);
213
+ this.setDownloadId(response.downloadId.toString());
214
+ this.audioUrlToPlay = response.location;
207
215
  }
208
216
  },
209
217
 
@@ -216,16 +224,19 @@ export default defineComponent({
216
224
  stopPlayer(): void {
217
225
  this.$store.commit('playerPlayPodcast');
218
226
  },
227
+ getDomain(): string{
228
+ let domain = "";
229
+ const domainArray: RegExpExecArray | null = /\.(.+)/.exec(window.location.host);
230
+ if(domainArray && null !== domainArray){
231
+ domain = domainArray[1];
232
+ }
233
+ return domain;
234
+ },
219
235
  getListenerId(): string{
220
236
  let listenerId = this.getCookie("octopus_listenerId");
221
237
  if(!listenerId){
222
238
  listenerId = new Date().valueOf().toString() + Math.random();
223
- let domain = "";
224
- const domainArray: RegExpExecArray | null = /\.(.+)/.exec(window.location.host);
225
- if(domainArray && null !== domainArray){
226
- domain = domainArray[1];
227
- }
228
- this.setCookie("octopus_listenerId", listenerId, ';domain='+domain);
239
+ this.setCookie("octopus_listenerId", listenerId, ';domain='+this.getDomain());
229
240
  }
230
241
  return listenerId;
231
242
  },
@@ -257,9 +268,9 @@ export default defineComponent({
257
268
  this.downloadId = newValue;
258
269
  },
259
270
  onError(): void {
260
- if (this.podcast && !this.listenError) {
271
+ if (this.podcast && ""!==this.audioUrlToPlay && !this.listenError) {
261
272
  this.listenError = true;
262
- } else if (this.podcast || this.media) {
273
+ } else if ((this.podcast && ""!==this.audioUrlToPlay ) || this.media) {
263
274
  this.playerError = true;
264
275
  }
265
276
  },
@@ -267,7 +278,7 @@ export default defineComponent({
267
278
  const mediaTarget = (event.currentTarget as HTMLMediaElement);
268
279
  if (this.podcast || this.live) {
269
280
  if (!this.getDownloadId()) {
270
- this.loadDownloadId();
281
+ return;
271
282
  }
272
283
  if (
273
284
  this.live &&
@@ -328,29 +339,17 @@ export default defineComponent({
328
339
  this.forceHide = false;
329
340
  }
330
341
  },
331
- loadDownloadId(): void {
332
- if (!this.podcast) return;
333
- const matching_cookies = document.cookie
334
- .split(';')
335
- .map(item => {
336
- const _return = item.trim().split('=');
337
- return _return.map(item => item.trim());
338
- })
339
- .filter(item => {
340
- if(!this.podcast){return '';}
341
- return 'player_' + this.podcast.podcastId === item[0];
342
- });
343
- if (1 === matching_cookies.length) {
344
- this.setDownloadId(matching_cookies[0][1]);
345
- }
346
- },
347
342
  async endListeningProgress(): Promise<void> {
348
343
  if (!this.getDownloadId()) return;
349
- await octopusApi.updatePlayerTime(
350
- this.getDownloadId(),
351
- Math.round(this.listenTime)
352
- );
353
- this.setDownloadId(null);
344
+ try {
345
+ await octopusApi.updatePlayerTime(
346
+ this.getDownloadId(),
347
+ Math.round(this.listenTime)
348
+ );
349
+ } catch{
350
+ //Do nothing
351
+ }
352
+ this.downloadId = null;
354
353
  this.notListenTime = 0;
355
354
  this.lastSend = 0;
356
355
  this.listenTime = 0;
@@ -12,7 +12,7 @@ const state:paramStore = {
12
12
  isPlaylist: false,
13
13
  isProduction: true,
14
14
  isContribution: true,
15
- ApiUri: 'https://api.staging.saooti.org/',
15
+ ApiUri: 'https://api.preprod.saooti.org/',
16
16
  podcastmaker: false,
17
17
  buttonPlus: true,
18
18
  allCategories: [],
@@ -26,10 +26,10 @@ const state:paramStore = {
26
26
  SharePlayer: true,
27
27
  ShareButtons: true,
28
28
  ShareDistribution: true,
29
- MiniplayerUri: 'https://playerbeta.staging.saooti.org/',
29
+ MiniplayerUri: 'https://playerbeta.preprod.saooti.org/',
30
30
  ouestFranceStyle: false,
31
31
  downloadButton: false,
32
- hlsUri: 'https://hls.staging.saooti.org/',
32
+ hlsUri: 'https://hls.preprod.saooti.org/',
33
33
  mainRubrique: 0,
34
34
  resourceUrl: undefined
35
35
  },
@@ -85,10 +85,10 @@ const state:paramStore = {
85
85
  userName: '',
86
86
  },
87
87
  octopusApi: {
88
- url: 'http://api.staging.saooti.org/',
89
- commentsUrl: 'http://comments.staging.saooti.org/',
90
- studioUrl: 'http://studio.staging.saooti.org/',
91
- playerUrl: 'https://playerbeta.staging.saooti.org/',
88
+ url: 'http://api.preprod.saooti.org/',
89
+ commentsUrl: 'http://comments.preprod.saooti.org/',
90
+ studioUrl: 'http://studio.preprod.saooti.org/',
91
+ playerUrl: 'https://playerbeta.preprod.saooti.org/',
92
92
  organisationId: undefined,
93
93
  rubriqueIdFilter: undefined,
94
94
  },