@saooti/octopus-sdk 34.0.4 → 34.0.6

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": "34.0.4",
3
+ "version": "34.0.6",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -295,6 +295,7 @@ export default defineComponent({
295
295
  color: white;
296
296
  text-transform: uppercase;
297
297
  position: absolute;
298
+ top:0;
298
299
  }
299
300
 
300
301
  .background-icon{
@@ -65,9 +65,9 @@
65
65
  />
66
66
  </div>
67
67
  <button
68
- v-if="!radio"
69
- :title="$t('Enlarge')"
70
- class="btn play-button-box btn-transparent text-light saooti-up"
68
+ :title="''!=transcriptText ? $t('View transcript'): $t('Enlarge')"
69
+ class="btn play-button-box btn-transparent text-light"
70
+ :class="''!=transcriptText ? 'saooti-text-to-speech':'saooti-up'"
71
71
  @click="changePlayerLargeVersion"
72
72
  />
73
73
  <button
@@ -3,7 +3,7 @@ import DurationHelper from '../../../helper/duration';
3
3
  import { state } from '../../../store/paramStore';
4
4
  import { defineComponent } from 'vue';
5
5
  import { RouteLocationRaw } from 'vue-router';
6
- import { MediaRadio, Radio } from '@/store/class/general/player';
6
+ import { MediaRadio, MetadataRadio, Radio } from '@/store/class/general/player';
7
7
  import octopusApi from '@saooti/octopus-api';
8
8
  export const playerDisplay = defineComponent({
9
9
  props: {
@@ -59,7 +59,7 @@ export const playerDisplay = defineComponent({
59
59
  },
60
60
  podcastTitle(): string {
61
61
  if(this.$store.state.player.radio){
62
- return this.$store.state.player.radio.metadata.title + " - " + this.$store.state.player.radio.metadata.artist;
62
+ return this.$store.state.player.radio.metadata.title + " " + this.$store.state.player.radio.metadata.artist;
63
63
  }
64
64
  if (this.$store.state.player.podcast) {
65
65
  if (this.isEmissionName)
@@ -109,8 +109,8 @@ export const playerDisplay = defineComponent({
109
109
  },
110
110
  methods: {
111
111
  async fetchRadioMetadata(): Promise<void>{
112
- const metadata = await octopusApi.fetchData<MediaRadio>(14, 'player/playing/'+this.$store.state.player.radio.canalId);
113
- this.$store.commit('player/radioMetadata', metadata);
112
+ const metadata = await octopusApi.fetchData<MetadataRadio>(14, 'player/playing/'+this.$store.state.player.radio.canalId);
113
+ this.$store.commit('player/radioMetadata', metadata.currently);
114
114
  },
115
115
  addKeyboardControl(event: KeyboardEvent): void{
116
116
  if(!event || null ===event){return;}
@@ -14,7 +14,8 @@ 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
+ audioElement: null as HTMLAudioElement|null,
18
+ hls: null as any,
18
19
  };
19
20
  },
20
21
  computed: {
@@ -84,18 +85,18 @@ export const playerLive = defineComponent({
84
85
  if (!Hls.isSupported()) {
85
86
  reject('Hls is not supported ! ');
86
87
  }
87
- const hls = new Hls();
88
- hls.on(Hls.Events.MANIFEST_PARSED, async () => {
88
+ this.hls = new Hls();
89
+ this.hls.on(Hls.Events.MANIFEST_PARSED, async () => {
89
90
  await this.initLiveDownloadId();
90
- hls.attachMedia((this.audioElement as HTMLAudioElement));
91
+ this.hls.attachMedia((this.audioElement as HTMLAudioElement));
91
92
  await (this.audioElement as HTMLAudioElement).play();
92
93
  this.onPlay();
93
94
  resolve();
94
95
  });
95
- hls.on(Hls.Events.ERROR, async() => {
96
+ this.hls.on(Hls.Events.ERROR, async() => {
96
97
  reject('There is an error while reading media content');
97
98
  });
98
- hls.loadSource(hlsStreamUrl);
99
+ this.hls.loadSource(hlsStreamUrl);
99
100
  });
100
101
  },
101
102
  setDownloadId(newValue: string|null): void {
@@ -114,5 +115,13 @@ export const playerLive = defineComponent({
114
115
  this.lastSend = 0;
115
116
  this.listenTime = 0;
116
117
  },
118
+ endingLive():void{
119
+ const audio: HTMLElement|null = document.getElementById('audio-player');
120
+ if(audio && this.hls){
121
+ this.hls.destroy();
122
+ (audio as HTMLAudioElement).src = '';
123
+ this.hls = null;
124
+ }
125
+ }
117
126
  },
118
127
  })
@@ -113,7 +113,11 @@ export const playerLogic = defineComponent({
113
113
  }else if('PAUSED' === this.status){
114
114
  audioPlayer.pause();
115
115
  }else if ('PLAYING' === this.status && this.radio){
116
- this.playRadio();
116
+ if(this.radio.isInit){
117
+ this.playRadio();
118
+ }else{
119
+ this.radio.isInit = true;
120
+ }
117
121
  }else if('PLAYING' === this.status){
118
122
  audioPlayer.play();
119
123
  }
@@ -163,6 +167,9 @@ export const playerLogic = defineComponent({
163
167
  this.setDownloadId(null);
164
168
  this.listenError = false;
165
169
  this.initComments();
170
+ if (this.live || this.radio) {
171
+ this.endingLive();
172
+ }
166
173
  },
167
174
  stopPlayer(): void {
168
175
  this.$store.commit('player/playPodcast');
@@ -260,11 +267,5 @@ export const playerLogic = defineComponent({
260
267
  }
261
268
  this.forceHide = true;
262
269
  },
263
- endingLive():void{
264
- const audio: HTMLElement|null = document.getElementById('audio-player');
265
- if(audio){
266
- (audio as HTMLAudioElement).src = '';
267
- }
268
- }
269
270
  },
270
271
  })
@@ -1,6 +1,5 @@
1
1
  <template>
2
2
  <div class="page-box">
3
- <button @click="playRadio">Radio</button>
4
3
  <template v-if="0 === rubriquageFilter.length">
5
4
  <PodcastInlineList
6
5
  v-for="c in categories"
@@ -89,14 +88,6 @@ export default defineComponent({
89
88
  }
90
89
  this.rubriqueId = rubriqueId;
91
90
  },
92
- playRadio(){
93
- this.$store.commit('player/playPodcast', {
94
- canalId: 3,
95
- url: "https://c6884219-e191-45ec-a931-6f34683c6ac7.stream.dev2.saooti.org/live.m3u8",
96
- metadata : ""
97
- });
98
-
99
- }
100
91
  }
101
92
  })
102
93
  </script>
package/src/locale/de.ts CHANGED
@@ -309,4 +309,5 @@ export default{
309
309
  "If the transcript is available, show it":"Wenn die Abschrift vorhanden ist, zeigen Sie sie",
310
310
  "Photo credits":"Bildnachweis",
311
311
  "Audio credits":"Audio-Credits",
312
+ "View transcript":"Transkript ansehen",
312
313
  }
package/src/locale/en.ts CHANGED
@@ -316,4 +316,5 @@ export default{
316
316
  "If the transcript is available, show it":"If the transcript is available, show it",
317
317
  "Photo credits":"Photo credits",
318
318
  "Audio credits":"Audio credits",
319
+ "View transcript":"View transcript",
319
320
  };
package/src/locale/es.ts CHANGED
@@ -309,4 +309,5 @@ export default{
309
309
  "If the transcript is available, show it":"Si la transcripción está disponible, muéstrela",
310
310
  "Photo credits":"Créditos fotográficos",
311
311
  "Audio credits":"Créditos de audio",
312
+ "View transcript":"Ver transcripción",
312
313
  }
package/src/locale/fr.ts CHANGED
@@ -316,4 +316,5 @@ export default{
316
316
  "If the transcript is available, show it":"Si la transcription est disponible, l'afficher",
317
317
  "Photo credits":"Crédits photo",
318
318
  "Audio credits":"Crédits audio",
319
+ "View transcript":"Afficher la transcription",
319
320
  };
package/src/locale/it.ts CHANGED
@@ -306,4 +306,5 @@ export default{
306
306
  "If the transcript is available, show it":"Se la trascrizione è disponibile, mostrala",
307
307
  "Photo credits":"Crediti fotografici",
308
308
  "Audio credits":"Crediti audio",
309
+ "View transcript":"Visualizza trascrizione",
309
310
  };
package/src/locale/sl.ts CHANGED
@@ -309,4 +309,5 @@ export default{
309
309
  "If the transcript is available, show it":"Če je prepis na voljo, ga pokažite",
310
310
  "Photo credits":"Avtorji fotografij",
311
311
  "Audio credits":"Avdio krediti",
312
+ "View transcript":"Ogled prepisa",
312
313
  }
@@ -0,0 +1,33 @@
1
+ import { ApiState, getDefaultApiState } from './classStore/typeApiStore';
2
+ import { Module, MutationTree } from 'vuex';
3
+ import { StoreState } from './classStore/typeAppStore';
4
+ const mutations = <MutationTree<ApiState>>{
5
+ init(state, apiUrls: ApiState) {
6
+ state.apiUrl= apiUrls.apiUrl;
7
+ state.commentUrl= apiUrls.commentUrl;
8
+ state.frontendUrl= apiUrls.frontendUrl;
9
+ state.ftpUrl= apiUrls.ftpUrl;
10
+ state.hlsUrl= apiUrls.hlsUrl;
11
+ state.imageUrl= apiUrls.imageUrl;
12
+ state.keycloakUrl= apiUrls.keycloakUrl;
13
+ state.mediaUrl= apiUrls.mediaUrl;
14
+ state.miniplayerUrl= apiUrls.miniplayerUrl;
15
+ state.processorUrl= apiUrls.processorUrl;
16
+ state.recoUrl= apiUrls.recoUrl;
17
+ state.radioUrl= apiUrls.radioUrl;
18
+ state.rssUrl= apiUrls.rssUrl;
19
+ state.rtmpUrl= apiUrls.rtmpUrl;
20
+ state.speechToTextUrl= apiUrls.speechToTextUrl;
21
+ state.studioUrl= apiUrls.studioUrl;
22
+ state.videoMakerUrl= apiUrls.videoMakerUrl;
23
+ state.storageUrl= apiUrls.storageUrl;
24
+ },
25
+ };
26
+
27
+ const ApiModule: Module<ApiState, StoreState> = {
28
+ namespaced: true,
29
+ state: getDefaultApiState(),
30
+ mutations: mutations,
31
+ };
32
+
33
+ export default ApiModule;
@@ -1,72 +1,76 @@
1
- import { createStore } from 'vuex'
2
- import { AppStoreData } from './classStore/typeAppStore';
1
+ import { createStore, MutationTree } from 'vuex';
2
+ import ApiStore from '@/store/ApiStore';
3
3
  import PlayerStore from '@/store/PlayerStore';
4
+ import { AppStoreData, StoreState } from './classStore/typeAppStore';
5
+
6
+ const mutations = <MutationTree<StoreState>>{
7
+ categoriesSet(state, categories) {
8
+ state.categories = categories;
9
+ },
10
+ categoriesOrgaSet(state, categories) {
11
+ state.categoriesOrga = categories;
12
+ },
13
+ filterOrga(state, filter) {
14
+ state.filter.organisationId = filter.orgaId;
15
+ if (filter.imgUrl || !filter.orgaId) {
16
+ state.filter.imgUrl = filter.imgUrl;
17
+ }
18
+ if (filter.name || !filter.orgaId) {
19
+ state.filter.name = filter.name;
20
+ }
21
+ if(filter.rubriquageArray){
22
+ state.filter.rubriquageArray = filter.rubriquageArray;
23
+ }
24
+ state.filter.live = filter.isLive;
25
+ state.filter.iab = undefined;
26
+ },
27
+ filterIab(state, iab) {
28
+ state.filter.iab = iab;
29
+ },
30
+ filterRubrique(state, rubriqueFilter) {
31
+ state.filter.rubriqueFilter = rubriqueFilter;
32
+ },
33
+ filterRubriqueDisplay(state, rubriques) {
34
+ state.filter.rubriqueDisplay = rubriques;
35
+ },
36
+ filterMedia(state, filter) {
37
+ if (filter.type) {
38
+ state.filter.typeMedia = filter.type;
39
+ }
40
+ if (filter.order) {
41
+ state.filter.sortOrder = filter.order;
42
+ }
43
+ if (filter.field) {
44
+ state.filter.sortField = filter.field;
45
+ }
46
+ },
47
+ initFilter(state, data) {
48
+ state.filter = {
49
+ ...state.filter,
50
+ ...data,
51
+ };
52
+ },
53
+ liveUpdate(state, isBeforeLive) {
54
+ state.liveUpdate.isBeforeLive = isBeforeLive;
55
+ },
56
+ setCommentIdentity(state, identity) {
57
+ state.comments.knownIdentity = identity;
58
+ },
59
+ setCommentLoaded(state, data) {
60
+ state.comments.actualPodcastId = data.podcastId;
61
+ state.comments.loadedComments = data.comments;
62
+ },
63
+ isEducation(state, isEducation) {
64
+ state.general.education = isEducation;
65
+ state.general.logoUrl = '/img/logo_education.webp';
66
+ state.general.metaTitle = 'RadioEducation.org';
67
+ },
68
+ };
4
69
  export default createStore({
5
70
  state: AppStoreData(),
6
71
  modules: {
72
+ api : ApiStore,
7
73
  player: PlayerStore
8
74
  },
9
- mutations: {
10
- categoriesSet(state, categories) {
11
- state.categories = categories;
12
- },
13
- categoriesOrgaSet(state, categories) {
14
- state.categoriesOrga = categories;
15
- },
16
- filterOrga(state, filter) {
17
- state.filter.organisationId = filter.orgaId;
18
- if (filter.imgUrl || !filter.orgaId) {
19
- state.filter.imgUrl = filter.imgUrl;
20
- }
21
- if (filter.name || !filter.orgaId) {
22
- state.filter.name = filter.name;
23
- }
24
- if(filter.rubriquageArray){
25
- state.filter.rubriquageArray = filter.rubriquageArray;
26
- }
27
- state.filter.live = filter.isLive;
28
- state.filter.iab = undefined;
29
- },
30
- filterIab(state, iab) {
31
- state.filter.iab = iab;
32
- },
33
- filterRubrique(state, rubriqueFilter) {
34
- state.filter.rubriqueFilter = rubriqueFilter;
35
- },
36
- filterRubriqueDisplay(state, rubriques) {
37
- state.filter.rubriqueDisplay = rubriques;
38
- },
39
- filterMedia(state, filter) {
40
- if (filter.type) {
41
- state.filter.typeMedia = filter.type;
42
- }
43
- if (filter.order) {
44
- state.filter.sortOrder = filter.order;
45
- }
46
- if (filter.field) {
47
- state.filter.sortField = filter.field;
48
- }
49
- },
50
- initFilter(state, data) {
51
- state.filter = {
52
- ...state.filter,
53
- ...data,
54
- };
55
- },
56
- liveUpdate(state, isBeforeLive) {
57
- state.liveUpdate.isBeforeLive = isBeforeLive;
58
- },
59
- setCommentIdentity(state, identity) {
60
- state.comments.knownIdentity = identity;
61
- },
62
- setCommentLoaded(state, data) {
63
- state.comments.actualPodcastId = data.podcastId;
64
- state.comments.loadedComments = data.comments;
65
- },
66
- isEducation(state, isEducation) {
67
- state.general.education = isEducation;
68
- state.general.logoUrl = '/img/logo_education.webp';
69
- state.general.metaTitle = 'RadioEducation.org';
70
- },
71
- },
75
+ mutations: mutations,
72
76
  });
@@ -40,7 +40,7 @@ const mutations = <MutationTree<Player>>{
40
40
  } else if (podcast.mediaId) {
41
41
  state.media = podcast;
42
42
  }else if(podcast.canalId){
43
- state.radio = podcast;
43
+ state.radio = {...podcast,...{isInit: false}};
44
44
  }
45
45
  },
46
46
 
@@ -5,6 +5,7 @@ export interface Radio{
5
5
  canalId: number;
6
6
  url: string;
7
7
  metadata: MediaRadio;
8
+ isInit: boolean,
8
9
  }
9
10
  export interface MediaRadio{
10
11
  artist:string;
@@ -18,6 +19,13 @@ export interface MediaRadio{
18
19
  uri:string;
19
20
  }
20
21
 
22
+ export interface MetadataRadio{
23
+ channelId:number;
24
+ currently:MediaRadio;
25
+ previously:Array<MediaRadio>;
26
+ }
27
+
28
+
21
29
 
22
30
  export interface Player{
23
31
  status: string; //STOPPED, LOADING, PLAYING, PAUSED
@@ -0,0 +1,43 @@
1
+
2
+ export interface ApiState {
3
+ apiUrl: undefined,
4
+ commentUrl: undefined,
5
+ frontendUrl: undefined,
6
+ ftpUrl: undefined,
7
+ hlsUrl: undefined,
8
+ imageUrl: undefined,
9
+ keycloakUrl: undefined,
10
+ mediaUrl: undefined,
11
+ miniplayerUrl:undefined,
12
+ processorUrl: undefined,
13
+ radioUrl: undefined,
14
+ recoUrl:undefined,
15
+ rssUrl: undefined,
16
+ rtmpUrl: undefined,
17
+ speechToTextUrl: undefined,
18
+ studioUrl: undefined,
19
+ videoMakerUrl: undefined,
20
+ storageUrl: undefined,
21
+ }
22
+ export function getDefaultApiState(): ApiState {
23
+ return {
24
+ apiUrl: undefined,
25
+ commentUrl:undefined,
26
+ frontendUrl: undefined,
27
+ ftpUrl: undefined,
28
+ hlsUrl: undefined,
29
+ imageUrl: undefined,
30
+ keycloakUrl: undefined,
31
+ mediaUrl: undefined,
32
+ miniplayerUrl:undefined,
33
+ processorUrl: undefined,
34
+ radioUrl: undefined,
35
+ recoUrl:undefined,
36
+ rssUrl: undefined,
37
+ rtmpUrl: undefined,
38
+ speechToTextUrl: undefined,
39
+ studioUrl: undefined,
40
+ videoMakerUrl: undefined,
41
+ storageUrl: undefined,
42
+ };
43
+ }
@@ -1,11 +1,12 @@
1
1
  import { Category } from '../class/general/category';
2
2
  import { CommentPodcast } from '../class/general/comment';
3
- import { Player } from '../class/general/player';
4
3
  import { Rubriquage } from '../class/rubrique/rubriquage';
5
4
  import { RubriquageFilter } from '../class/rubrique/rubriquageFilter';
6
5
  import { Rubrique } from '../class/rubrique/rubrique';
6
+ import { ApiState } from './typeApiStore';
7
7
  import { AuthState } from './typeAuthStore';
8
8
  import { getDefaultPlayerState } from './typePlayerStore';
9
+ import { Player } from '../class/general/player';
9
10
 
10
11
  export interface Filter{
11
12
  organisationId: string | undefined;
@@ -41,6 +42,7 @@ export interface StoreState {
41
42
  };
42
43
  player: Player;
43
44
  auth?: AuthState;
45
+ api?: ApiState;
44
46
  }
45
47
 
46
48
  export function AppStoreData(): StoreState {
@@ -12,7 +12,7 @@ const state:ParamStore = {
12
12
  isPlaylist: true,
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,13 +83,13 @@ const state:ParamStore = {
83
83
  userName: '',
84
84
  },
85
85
  octopusApi: {
86
- url: 'https://api.dev2.saooti.org/',
87
- commentsUrl: 'https://comments.dev2.saooti.org/',
88
- imageUrl:'https://imageproxy.dev2.saooti.org/',
89
- studioUrl: 'https://studio.dev2.saooti.org/',
90
- playerUrl: 'https://playerbeta.dev2.saooti.org/',
91
- speechToTextUrl:'https://speech2text.dev2.saooti.org/',
92
- recoUrl: 'https://reco.dev2.saooti.org/',
86
+ url: 'https://api.preprod.saooti.org/',
87
+ commentsUrl: 'https://comments.preprod.saooti.org/',
88
+ imageUrl:'https://imageproxy.preprod.saooti.org/',
89
+ studioUrl: 'https://studio.preprod.saooti.org/',
90
+ playerUrl: 'https://playerbeta.preprod.saooti.org/',
91
+ speechToTextUrl:'https://speech2text.preprod.saooti.org/',
92
+ recoUrl: 'https://reco.preprod.saooti.org/',
93
93
  organisationId: undefined,
94
94
  rubriqueIdFilter: undefined,
95
95
  },