@saooti/octopus-sdk 33.0.2 → 33.0.4

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
@@ -688,3 +688,6 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
688
688
  * 32.0.35 Enlever Dummy param
689
689
  * 32.0.36 Select -> font family
690
690
  * 32.0.40 Problème majeur !!!
691
+
692
+ * 33.0.3 SpeechToText player octopus
693
+ * 33.0.4 Image webp
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "33.0.2",
3
+ "version": "33.0.4",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
Binary file
Binary file
Binary file
Binary file
@@ -198,7 +198,7 @@ body{
198
198
  display: contents;
199
199
  }
200
200
 
201
- .img-box {
201
+ .img-box{
202
202
  height: 13rem;
203
203
  width: 13rem;
204
204
  background-size: cover;
@@ -119,7 +119,7 @@ import { Organisation } from '@/store/class/general/organisation';
119
119
 
120
120
  const ELEMENTS_COUNT = 50;
121
121
  const DEFAULT_ORGANISATION_ID = "";
122
- const DEFAULT_ORGANISATION_IMAGE = '/img/emptypodcast.png';
122
+ const DEFAULT_ORGANISATION_IMAGE = '/img/emptypodcast.webp';
123
123
 
124
124
  const getDefaultOrganistion = (defaultName: string) => {
125
125
  if(''===defaultName){
@@ -66,7 +66,7 @@
66
66
  >
67
67
  <img
68
68
  class="acpm_image"
69
- src="/img/ACPM.png"
69
+ src="/img/ACPM.webp"
70
70
  :title="$t('Octopus is ACPM Podcast accredited')"
71
71
  :alt="$t('Octopus is ACPM Podcast accredited')"
72
72
  >
@@ -117,7 +117,7 @@ export default defineComponent({
117
117
  return undefined;
118
118
  },
119
119
  logoUrl(): string {
120
- return this.isEducation ?'/img/logo_education.png': '/img/logo_octopus_final.svg';
120
+ return this.isEducation ?'/img/logo_education.webp': '/img/logo_octopus_final.svg';
121
121
  },
122
122
  isPodcastmaker(): boolean {
123
123
  return (state.generalParameters.podcastmaker as boolean);
@@ -18,6 +18,7 @@
18
18
  @playing="onPlay"
19
19
  @durationChange="onTimeUpdate"
20
20
  @error="onError"
21
+ @seeked="onSeeked"
21
22
  />
22
23
  <PlayerCompact
23
24
  v-if="!largeVersion"
@@ -60,12 +60,12 @@
60
60
  </div>
61
61
  <button
62
62
  :title="$t('Enlarge')"
63
- class="btn play-button-box primary-bg text-light saooti-up"
63
+ class="btn play-button-box saooti-up"
64
64
  @click="changePlayerLargeVersion"
65
65
  />
66
66
  <button
67
67
  :title="$t('Close')"
68
- class="btn play-button-box primary-bg text-light saooti-remove"
68
+ class="btn play-button-box saooti-remove"
69
69
  @click="stopPlayer"
70
70
  />
71
71
  <PlayerTimeline
@@ -12,7 +12,7 @@
12
12
  :to="podcastShareUrl"
13
13
  >
14
14
  <img
15
- v-lazy="proxyImageUrl(podcastImage,'260')"
15
+ v-lazy="proxyImageUrl(podcastImage,'200')"
16
16
  :alt="$t('Podcast image')"
17
17
  class="img-box"
18
18
  >
@@ -46,7 +46,10 @@
46
46
  <div>{{ totalTime }}</div>
47
47
  </div>
48
48
  </div>
49
- <div class="d-flex align-items-center">
49
+ <div class="flex-grow-1 d-flex align-items-center w-100" v-if="''!=transcriptText">
50
+ <div class="flex-grow-1 p-1 text-center mx-3 transcript-bg rounded">{{transcriptText}}</div>
51
+ </div>
52
+ <div class="d-flex align-items-center flex-grow-1">
50
53
  <button
51
54
  class="btn fs-1 bg-transparent text-light saooti-backward"
52
55
  @click="seekClick(-15)"
@@ -131,10 +134,8 @@ export default defineComponent({
131
134
  <style lang="scss">
132
135
  .octopus-app{
133
136
  .player-container .img-box{
134
- @media (max-width: 960px) {
135
- width: 10rem;
136
- height: 10rem;
137
- }
137
+ width: 10rem;
138
+ height: 10rem;
138
139
  }
139
140
  .player-reduce-button{
140
141
  position: absolute;
@@ -163,5 +164,8 @@ export default defineComponent({
163
164
  flex-shrink: 0;
164
165
  cursor: pointer;
165
166
  }
167
+ .transcript-bg{
168
+ background: #3e3e3e;
169
+ }
166
170
  }
167
171
  </style>
@@ -68,6 +68,9 @@ export const playerDisplay = defineComponent({
68
68
  if (this.$store.state.player.podcast) return this.$store.state.player.podcast.emission.name;
69
69
  return '';
70
70
  },
71
+ transcriptText():string{
72
+ return this.$store.state.player.transcript?.actualText ?? "";
73
+ }
71
74
  },
72
75
  created(){
73
76
  window.addEventListener('keydown', this.addKeyboardControl);
@@ -59,6 +59,7 @@ export const playerLogic = defineComponent({
59
59
  deep: true,
60
60
  handler(){
61
61
  this.reInitPlayer();
62
+ this.getTranscription();
62
63
  }
63
64
  },
64
65
  live: {
@@ -95,6 +96,40 @@ export const playerLogic = defineComponent({
95
96
  },
96
97
 
97
98
  methods: {
99
+ async getTranscription(): Promise<void>{
100
+ if(!this.podcast){
101
+ this.$store.commit('playerTranscript',undefined);
102
+ return;
103
+ }
104
+ const result = await octopusApi.fetchDataPublic<string>(11 , `response/${this.podcast.podcastId}`);
105
+ const arrayTranscript = this.parseSrt(result);
106
+ const actualText = arrayTranscript?.[0]?.startTime === 0 ? arrayTranscript[0].text : "";
107
+ this.$store.commit('playerTranscript',{actual: 0,actualText:actualText, value : arrayTranscript});
108
+ },
109
+ parseSrt(transcript: string){
110
+ var pattern = /(\d+)\n([\d:,]+)\s+-{2}\>\s+([\d:,]+)\n([\s\S]*?(?=\n{2}|$))/gm;
111
+ var result = [];
112
+ if (typeof(transcript) != 'string'){
113
+ return;
114
+ }
115
+ if (transcript == null){
116
+ return;
117
+ }
118
+ transcript = transcript.replace(/\r\n|\r|\n|\t/g, '\n');
119
+ let matches;
120
+ while ((matches = pattern.exec(transcript)) != null) {
121
+ result.push({
122
+ startTime: this.srtTimeToSeconds(matches[2]),
123
+ endTime: this.srtTimeToSeconds(matches[3]),
124
+ text: matches[4]
125
+ });
126
+ }
127
+ return result;
128
+ },
129
+ srtTimeToSeconds(time:string): number{
130
+ var a = time.split(':');
131
+ return (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+parseFloat(a[2]));
132
+ },
98
133
  getDomain(): string{
99
134
  let domain = "";
100
135
  const domainArray: RegExpExecArray | null = /\.(.+)/.exec(window.location.host);
@@ -184,11 +219,18 @@ export const playerLogic = defineComponent({
184
219
  }
185
220
  return streamDuration;
186
221
  },
222
+ onTimeUpdateTranscript(currentTime:number){
223
+ if((this.$store.state.player.transcript?.value[this.$store.state.player.transcript?.actual]?.endTime ?? Infinity) < currentTime){
224
+ this.$store.state.player.transcript.actual +=1;
225
+ this.$store.state.player.transcript.actualText = this.$store.state.player.transcript?.value[this.$store.state.player.transcript?.actual].text ?? "";
226
+ }
227
+ },
187
228
  onTimeUpdatePodcast(streamDuration:number, currentTime:number){
188
229
  this.displayAlertBar = false;
189
230
  this.percentLiveProgress = 100;
190
231
  this.$store.commit('playerTotalTime', streamDuration);
191
232
  this.$store.commit('playerElapsed', currentTime / streamDuration);
233
+ this.onTimeUpdateTranscript(currentTime);
192
234
  },
193
235
  onTimeUpdateLive(streamDuration: number, currentTime:number){
194
236
  if(!this.live){return;}
@@ -236,6 +278,17 @@ export const playerLogic = defineComponent({
236
278
  }
237
279
  this.onTimeUpdateLive(streamDuration,mediaTarget.currentTime);
238
280
  },
281
+ onSeeked(event: Event):void {
282
+ const mediaTarget = (event.currentTarget as HTMLMediaElement);
283
+ const currentTime = mediaTarget.currentTime;
284
+ if(this.$store.state.player.transcript){
285
+ let newActual = 0;
286
+ while (currentTime > (this.$store.state.player.transcript.value[newActual]?.endTime ?? Infinity)){
287
+ newActual +=1;
288
+ }
289
+ this.$store.state.player.transcript.actual = newActual;
290
+ }
291
+ },
239
292
  onFinished(): void {
240
293
  this.setDownloadId(null);
241
294
  if (this.live) {
@@ -11,7 +11,7 @@
11
11
  </div>
12
12
  <img
13
13
  class="stop-octopus-img"
14
- src="/img/403.jpeg"
14
+ src="/img/403.webp"
15
15
  :alt="$t('You do not have the right to access this page')"
16
16
  >
17
17
  </div>
@@ -80,6 +80,9 @@ export default createStore({
80
80
  playerSeekTime(state, seekTime) {
81
81
  state.player.seekTime = seekTime;
82
82
  },
83
+ playerTranscript(state, transcript) {
84
+ state.player.transcript = transcript;
85
+ },
83
86
 
84
87
  filterOrga(state, filter) {
85
88
  state.filter.organisationId = filter.orgaId;
@@ -11,4 +11,5 @@ export interface Player{
11
11
  live: Podcast|undefined;
12
12
  stop?: boolean;
13
13
  seekTime?: number;
14
+ transcript?:{actual: number, actualText:string, value : Array<{endTime: number, startTime:number, text: string}>};
14
15
  }
@@ -78,15 +78,15 @@ const state:ParamStore = {
78
78
  contactLink: undefined,
79
79
  },
80
80
  organisation: {
81
- imageUrl: '/img/emptypodcast.png',
81
+ imageUrl: '/img/emptypodcast.webp',
82
82
  name: 'Saooti',
83
83
  userName: '',
84
84
  },
85
85
  octopusApi: {
86
- url: 'http://api.dev2.saooti.org/',
87
- commentsUrl: 'http://comments.dev2.saooti.org/',
88
- imageUrl:'http://imageproxy.dev2.saooti.org/',
89
- studioUrl: 'http://studio.dev2.saooti.org/',
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
90
  playerUrl: 'https://playerbeta.dev2.saooti.org/',
91
91
  speechToTextUrl:'https://speech2text.dev2.saooti.org/',
92
92
  recoUrl: 'https://reco.dev2.saooti.org/',
Binary file
Binary file
Binary file
Binary file