@saooti/octopus-sdk 30.0.44 → 30.0.48

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
@@ -540,4 +540,8 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
540
540
  * 30.0.41 Inline list arrow
541
541
  * 30.0.42 Resize rubriqueList
542
542
  * 30.0.43 Resize rubriqueList
543
- * 30.0.44 ProgressBar pour le soir
543
+ * 30.0.44 ProgressBar pour le soir
544
+ * 30.0.45 ProgressBar pour le soir
545
+ * 30.0.46 Param pour le soir
546
+ * 30.0.47 Live error
547
+ * 30.0.48 Podcastmaker ScrollOverflow PodcastInlineList
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "30.0.44",
3
+ "version": "30.0.48",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -79,7 +79,8 @@
79
79
  "no-console": "off",
80
80
  "no-debugger": "off",
81
81
  "@typescript-eslint/ban-ts-ignore": "off",
82
- "@typescript-eslint/ban-ts-comment": "off"
82
+ "@typescript-eslint/ban-ts-comment": "off",
83
+ "no-async-promise-executor":"off"
83
84
  },
84
85
  "parserOptions": {
85
86
  "parser": "@typescript-eslint/parser"
@@ -66,6 +66,25 @@
66
66
  }
67
67
  }
68
68
  }
69
+ .element-list-inline.overflowScroll {
70
+ display: flex;
71
+ flex-wrap: wrap;
72
+ -webkit-overflow-scrolling: touch;
73
+ scroll-behavior: smooth;
74
+ padding-bottom: 1rem;
75
+ width: 100%;
76
+ height: 80vh;
77
+ overflow-y: auto;
78
+ grid-gap: inherit;
79
+ @media (max-width: 960px) {
80
+ overflow-x: hidden;
81
+ flex-direction: column;
82
+ flex-wrap: nowrap;
83
+ }
84
+ .item-phone-margin {
85
+ margin: 1rem 0.5rem !important;
86
+ }
87
+ }
69
88
 
70
89
  .emission-list {
71
90
  align-self: stretch;
@@ -55,7 +55,6 @@
55
55
  />
56
56
  </transition-group>
57
57
  <router-link
58
- v-if="!overflowScroll"
59
58
  :to="href"
60
59
  class="btn btn-link align-self-center width-fit-content m-4"
61
60
  >
@@ -203,14 +202,14 @@ export default defineComponent({
203
202
  },
204
203
  handleResize(): void {
205
204
  if (!this.$el) return;
206
- if (window.innerWidth <= PHONE_WIDTH) {
207
- this.size = 10;
208
- return;
209
- }
210
205
  if (this.overflowScroll) {
211
206
  this.size = 20;
212
207
  return;
213
208
  }
209
+ if (window.innerWidth <= PHONE_WIDTH) {
210
+ this.size = 10;
211
+ return;
212
+ }
214
213
  const width = (this.$el as HTMLElement).offsetWidth;
215
214
  const sixteen = domHelper.convertRemToPixels(this.itemSize + 0.7);
216
215
  this.size = Math.floor(width / sixteen);
@@ -270,24 +269,5 @@ export default defineComponent({
270
269
  margin-bottom: 1rem;
271
270
  }
272
271
  }
273
- .element-list-inline.overflowScroll {
274
- display: flex;
275
- flex-wrap: wrap;
276
- -webkit-overflow-scrolling: touch;
277
- scroll-behavior: smooth;
278
- padding-bottom: 1rem;
279
- width: 100%;
280
- height: 80vh;
281
- overflow-y: auto;
282
- grid-gap: inherit;
283
- @media (max-width: 960px) {
284
- overflow-x: hidden;
285
- flex-direction: column;
286
- flex-wrap: nowrap;
287
- }
288
- .item-phone-margin {
289
- margin: 1rem 0.5rem !important;
290
- }
291
- }
292
272
  }
293
273
  </style>
@@ -77,36 +77,7 @@
77
77
  <!-- eslint-enable -->
78
78
  </div>
79
79
  </router-link>
80
- <div
81
- v-if="isProgressBar"
82
- class="d-flex align-items-center"
83
- >
84
- <div class="me-2">
85
- {{ playedTime(p) }}
86
- </div>
87
- <div class="position-relative flex-grow-1">
88
- <div
89
- class="progress flex-grow-1 c-hand"
90
- @mouseup="seekTo($event, p)"
91
- >
92
- <div
93
- class="progress-bar primary-bg"
94
- role="progressbar"
95
- aria-valuenow="0"
96
- aria-valuemin="0"
97
- aria-valuemax="100"
98
- :style="'width: ' + percentProgress(p) + '%'"
99
- />
100
- <div
101
- class="progress-bar-cursor"
102
- :style="'left:' + percentProgress(p) + '%'"
103
- />
104
- </div>
105
- </div>
106
- <div class="ms-2">
107
- {{ totalTime(p) }}
108
- </div>
109
- </div>
80
+ <PodcastPlayBar :podcast="p" />
110
81
  </div>
111
82
  <div
112
83
  v-if="
@@ -157,11 +128,15 @@ import octopusApi from '@saooti/octopus-api';
157
128
  import { Emission } from '@/store/class/general/emission';
158
129
  import { Podcast } from '@/store/class/general/podcast';
159
130
  import { state } from '../../../store/paramStore';
160
- import DurationHelper from '../../../helper/duration';
131
+ import PodcastPlayBar from '../podcasts/PodcastPlayBar.vue';
161
132
  import { displayMethods } from '../../mixins/functions';
162
133
  import { defineComponent } from 'vue'
163
134
  export default defineComponent({
164
135
  name: 'EmissionPlayerItem',
136
+
137
+ components:{
138
+ PodcastPlayBar
139
+ },
165
140
  mixins: [displayMethods],
166
141
  props: {
167
142
  emission: { default: ()=>({}), type: Object as ()=>Emission },
@@ -190,9 +165,6 @@ export default defineComponent({
190
165
  organisationId(): string|undefined {
191
166
  return state.generalParameters.organisationId;
192
167
  },
193
- isProgressBar(){
194
- return (state.emissionsPage.progressBar as boolean);
195
- },
196
168
  editRight(): boolean {
197
169
  if (
198
170
  (this.authenticated && this.organisationId === this.emission.orga.id) ||
@@ -221,36 +193,6 @@ export default defineComponent({
221
193
  }
222
194
  },
223
195
  methods: {
224
- seekTo(event: MouseEvent, podcast: Podcast): void {
225
- if(podcast!== this.$store.state.player.podcast){return;}
226
- const rect = (event.currentTarget as Element).getBoundingClientRect();
227
- const barWidth = (event.currentTarget as Element).clientWidth;
228
- const x = event.clientX - rect.left;
229
- const percentPosition = x / barWidth;
230
- if (percentPosition * 100 >= this.percentLiveProgress) return;
231
- const seekTime = this.$store.state.player.total * percentPosition;
232
- this.$store.commit("playerSeekTime", seekTime);
233
- },
234
- percentProgress(podcast: Podcast): number{
235
- if(podcast !== this.$store.state.player.podcast){
236
- return 0;
237
- }
238
- if(!this.$store.state.player.elapsed){return 0;}
239
- return this.$store.state.player.elapsed * 100;
240
- },
241
- playedTime(podcast: Podcast): string{
242
- if(podcast === this.$store.state.player.podcast){
243
- if (this.$store.state.player.elapsed && this.$store.state.player.elapsed > 0 && this.$store.state.player.total && this.$store.state.player.total > 0) {
244
- return DurationHelper.formatDuration(
245
- Math.round(this.$store.state.player.elapsed * this.$store.state.player.total)
246
- );
247
- }
248
- }
249
- return '00:00';
250
- },
251
- totalTime(podcast: Podcast): string {
252
- return DurationHelper.formatDuration(Math.round(podcast.duration/1000));
253
- },
254
196
  async loadPodcasts(): Promise<void> {
255
197
  const nb = this.nbPodcasts ? this.nbPodcasts : 2;
256
198
  const data = await octopusApi.fetchPodcasts({
@@ -22,7 +22,7 @@
22
22
  </button>
23
23
  </div>
24
24
  <div
25
- v-if="!isArrow"
25
+ v-if="!isArrow && !overflowScroll"
26
26
  class="hide-phone"
27
27
  >
28
28
  <button
@@ -51,7 +51,10 @@
51
51
  :name="transitionName"
52
52
  class="element-list-inline"
53
53
  tag="ul"
54
- :class="[alignLeft ? 'justify-content-start' : '']"
54
+ :class="[
55
+ alignLeft ? 'justify-content-start' : '',
56
+ overflowScroll ? 'overflowScroll' : '',
57
+ ]"
55
58
  >
56
59
  <PodcastItem
57
60
  v-for="p in podcasts"
@@ -106,6 +109,7 @@ export default defineComponent({
106
109
  rubriqueId: { default: () => [], type: Array as ()=> Array<number> },
107
110
  rubriquageId:{ default: () => [], type: Array as ()=> Array<number> },
108
111
  noRubriquageId: { default: () => [], type: Array as ()=> Array<number> },
112
+ query: { default: undefined, type: String},
109
113
  },
110
114
  emits: ['update:isArrow'],
111
115
 
@@ -130,6 +134,9 @@ export default defineComponent({
130
134
  sizeItem(): number {
131
135
  return state.generalParameters.podcastItem ? (state.generalParameters.podcastItem as number): 13;
132
136
  },
137
+ overflowScroll(): boolean {
138
+ return (state.emissionPage.overflowScroll as boolean);
139
+ },
133
140
  filterOrga(): string {
134
141
  return this.$store.state.filter.organisationId;
135
142
  },
@@ -170,7 +177,7 @@ export default defineComponent({
170
177
  return this.direction > 0 ? 'out-left' : 'out-right';
171
178
  },
172
179
  watchVariable():string{
173
- return `${this.emissionId}|${this.organisationId}|${this.filterOrga}|${this.iabId}|${this.rubriqueId}|${this.rubriquageId}`;
180
+ return `${this.emissionId}|${this.organisationId}|${this.filterOrga}|${this.iabId}|${this.rubriqueId}|${this.rubriquageId}|${this.query}`;
174
181
  }
175
182
  },
176
183
  watch: {
@@ -210,6 +217,7 @@ export default defineComponent({
210
217
  rubriquageId: this.rubriquageId.length ?this.rubriquageId : undefined,
211
218
  noRubriquageId: this.noRubriquageId.length ? this.noRubriquageId : undefined,
212
219
  sort: this.popularSort ? 'POPULARITY' : 'DATE',
220
+ query: this.query,
213
221
  });
214
222
  this.loading = false;
215
223
  this.loaded = true;
@@ -247,6 +255,10 @@ export default defineComponent({
247
255
  },
248
256
  handleResize(): void {
249
257
  if (!this.$el) return;
258
+ if (this.overflowScroll) {
259
+ this.size = 20;
260
+ return;
261
+ }
250
262
  if (window.innerWidth <= PHONE_WIDTH) {
251
263
  this.size = 10;
252
264
  return;
@@ -60,6 +60,10 @@
60
60
  {{ title }}
61
61
  </div>
62
62
  </router-link>
63
+ <PodcastPlayBar
64
+ :podcast="podcast"
65
+ class="mx-2"
66
+ />
63
67
  <div class="d-flex justify-content-between">
64
68
  <router-link
65
69
  v-if="!isPodcastmaker"
@@ -88,7 +92,7 @@ import { state } from '../../../store/paramStore';
88
92
  import moment from 'moment';
89
93
  // @ts-ignore
90
94
  import humanizeDuration from 'humanize-duration';
91
-
95
+ import PodcastPlayBar from '../podcasts/PodcastPlayBar.vue';
92
96
  import { Podcast } from '@/store/class/general/podcast';
93
97
  import { Category } from '@/store/class/general/category';
94
98
  import { defineComponent } from 'vue'
@@ -98,6 +102,7 @@ export default defineComponent({
98
102
  components: {
99
103
  AnimatorsItem,
100
104
  PodcastImage,
105
+ PodcastPlayBar
101
106
  },
102
107
 
103
108
  props: {
@@ -116,6 +116,9 @@
116
116
  :participants="podcast.guests"
117
117
  :is-guest="true"
118
118
  />
119
+ <PodcastPlayBar
120
+ :podcast="podcast"
121
+ />
119
122
  <div v-if="editRight && !isPodcastmaker">
120
123
  <div
121
124
  v-if="podcast.annotations && podcast.annotations.RSS"
@@ -152,6 +155,7 @@
152
155
  </template>
153
156
 
154
157
  <script lang="ts">
158
+ import PodcastPlayBar from './PodcastPlayBar.vue';
155
159
  import PodcastImage from './PodcastImage.vue';
156
160
  import ParticipantDescription from './ParticipantDescription.vue';
157
161
  import TagList from './TagList.vue';
@@ -174,6 +178,7 @@ export default defineComponent({
174
178
  ShareButtons,
175
179
  TagList,
176
180
  ErrorMessage,
181
+ PodcastPlayBar
177
182
  },
178
183
 
179
184
  mixins:[displayMethods],
@@ -0,0 +1,100 @@
1
+ <template>
2
+ <div
3
+ v-if="isProgressBar"
4
+ class="d-flex align-items-center podcast-play-bar"
5
+ >
6
+ <div class="me-2">
7
+ {{ playedTime }}
8
+ </div>
9
+ <div class="position-relative flex-grow-1">
10
+ <div
11
+ class="progress flex-grow-1 c-hand"
12
+ @mouseup="seekTo"
13
+ >
14
+ <div
15
+ class="progress-bar primary-bg"
16
+ role="progressbar"
17
+ aria-valuenow="0"
18
+ aria-valuemin="0"
19
+ aria-valuemax="100"
20
+ :style="'width: ' + percentProgress + '%'"
21
+ />
22
+ <div
23
+ class="progress-bar-cursor"
24
+ :style="'left:' + percentProgress + '%'"
25
+ />
26
+ </div>
27
+ </div>
28
+ <div class="ms-2">
29
+ {{ totalTime }}
30
+ </div>
31
+ </div>
32
+ </template>
33
+
34
+ <script lang="ts">
35
+ import { Podcast } from '@/store/class/general/podcast';
36
+ import DurationHelper from '../../../helper/duration';
37
+ import { displayMethods } from '../../mixins/functions';
38
+ import { state } from '../../../store/paramStore';
39
+ import { defineComponent } from 'vue'
40
+ export default defineComponent({
41
+ name: 'PodcastPlayBar',
42
+ mixins: [displayMethods],
43
+ props: {
44
+ podcast: { default: ()=>({}), type: Object as ()=>Podcast },
45
+ },
46
+ computed: {
47
+ isProgressBar(): boolean{
48
+ return (state.emissionsPage.progressBar as boolean);
49
+ },
50
+ percentProgress(): number{
51
+ if(this.podcast !== this.$store.state.player.podcast){
52
+ return 0;
53
+ }
54
+ if(!this.$store.state.player.elapsed){return 0;}
55
+ return this.$store.state.player.elapsed * 100;
56
+ },
57
+ playedTime(): string{
58
+ if(this.podcast === this.$store.state.player.podcast){
59
+ if (this.$store.state.player.elapsed && this.$store.state.player.elapsed > 0 && this.$store.state.player.total && this.$store.state.player.total > 0) {
60
+ return DurationHelper.formatDuration(
61
+ Math.round(this.$store.state.player.elapsed * this.$store.state.player.total)
62
+ );
63
+ }
64
+ }
65
+ return '00:00';
66
+ },
67
+ totalTime(): string {
68
+ return DurationHelper.formatDuration(Math.round(this.podcast.duration/1000));
69
+ },
70
+ },
71
+ methods: {
72
+ seekTo(event: MouseEvent): void {
73
+ if(this.podcast!== this.$store.state.player.podcast){return;}
74
+ const rect = (event.currentTarget as Element).getBoundingClientRect();
75
+ const barWidth = (event.currentTarget as Element).clientWidth;
76
+ const x = event.clientX - rect.left;
77
+ const percentPosition = x / barWidth;
78
+ if (percentPosition * 100 >= this.percentLiveProgress) return;
79
+ const seekTime = this.$store.state.player.total * percentPosition;
80
+ this.$store.commit("playerSeekTime", seekTime);
81
+ }
82
+ },
83
+ })
84
+ </script>
85
+
86
+ <style lang="scss">
87
+ .podcast-play-bar {
88
+ .progress{
89
+ height: 6px;
90
+ }
91
+ .progress-bar-cursor{
92
+ width: 10px;
93
+ height: 10px;
94
+ border-radius: 50%;
95
+ background: black;
96
+ align-self: center;
97
+ position: absolute;
98
+ }
99
+ }
100
+ </style>
@@ -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>
@@ -70,25 +70,27 @@
70
70
  :emission-id="emissionId"
71
71
  />
72
72
  </div>
73
- <LiveHorizontalList
74
- v-if="!isPodcastmaker"
75
- :emission-id="emissionId"
76
- />
77
- <PodcastFilterList
78
- v-if="!isOuestFrance"
79
- :emission-id="emissionId"
80
- :category-filter="false"
81
- :edit-right="editRight"
82
- :productor-id="emission.orga.id"
83
- @fetch="fetch"
84
- />
85
- <PodcastList
86
- v-else
87
- :first="0"
88
- :size="15"
89
- :emission-id="emissionId"
90
- @fetch="fetch"
91
- />
73
+ <template v-if="isDisplayPodcasts">
74
+ <LiveHorizontalList
75
+ v-if="!isPodcastmaker"
76
+ :emission-id="emissionId"
77
+ />
78
+ <PodcastFilterList
79
+ v-if="!isOuestFrance"
80
+ :emission-id="emissionId"
81
+ :category-filter="false"
82
+ :edit-right="editRight"
83
+ :productor-id="emission.orga.id"
84
+ @fetch="fetch"
85
+ />
86
+ <PodcastList
87
+ v-else
88
+ :first="0"
89
+ :size="15"
90
+ :emission-id="emissionId"
91
+ @fetch="fetch"
92
+ />
93
+ </template>
92
94
  </div>
93
95
  <ClassicLoading
94
96
  :loading-text="!loaded?$t('Loading content ...'):undefined"
@@ -172,6 +174,9 @@ export default defineComponent({
172
174
  isRssButton(): boolean {
173
175
  return (state.emissionPage.rssButton as boolean);
174
176
  },
177
+ isDisplayPodcasts(): boolean {
178
+ return (state.emissionPage.isDisplayPodcasts as boolean);
179
+ },
175
180
  isPodcastmaker(): boolean {
176
181
  return (state.generalParameters.podcastmaker as boolean);
177
182
  },
@@ -55,6 +55,8 @@ const state:paramStore = {
55
55
  emissionPage: {
56
56
  ouestFranceStyle: false,
57
57
  rssButton: false,
58
+ isDisplayPodcasts:true,
59
+ overflowScroll:false
58
60
  },
59
61
  intervenantPage: {
60
62
  lightStyle: false,
@@ -142,6 +144,8 @@ export interface EmissionsPage{
142
144
  export interface EmissionPage{
143
145
  ouestFranceStyle?: boolean,
144
146
  rssButton?: boolean,
147
+ isDisplayPodcasts?:boolean,
148
+ overflowScroll?: boolean,
145
149
  }
146
150
  export interface IntervenantPage{
147
151
  lightStyle?: boolean,