@saooti/octopus-sdk 38.1.2 → 38.1.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/package.json
CHANGED
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
</template>
|
|
61
61
|
</template>
|
|
62
62
|
<hr />
|
|
63
|
-
<
|
|
63
|
+
<button class="octopus-dropdown-item" @click="logoutFunction">
|
|
64
64
|
{{ $t("Logout") }}
|
|
65
|
-
</
|
|
65
|
+
</button>
|
|
66
66
|
</template>
|
|
67
67
|
<router-link class="octopus-dropdown-item" to="/main/pub/contact">
|
|
68
68
|
{{ $t("Contact") }}
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
</template>
|
|
73
73
|
|
|
74
74
|
<script lang="ts">
|
|
75
|
+
import octopusApi from "@saooti/octopus-api";
|
|
75
76
|
import { state } from "../../stores/ParamSdkStore";
|
|
76
77
|
import ClassicPopover from "../misc/ClassicPopover.vue";
|
|
77
78
|
import { useAuthStore } from "@/stores/AuthStore";
|
|
@@ -147,5 +148,15 @@ export default defineComponent({
|
|
|
147
148
|
return state.generalParameters.isContribution ?? false;
|
|
148
149
|
},
|
|
149
150
|
},
|
|
151
|
+
methods:{
|
|
152
|
+
async logoutFunction(){
|
|
153
|
+
try {
|
|
154
|
+
await octopusApi.postDataPublic(4, '/logout', undefined);
|
|
155
|
+
this.$router.push('/');
|
|
156
|
+
} catch (error) {
|
|
157
|
+
//Do nothing
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
150
161
|
});
|
|
151
162
|
</script>
|
|
@@ -2,12 +2,33 @@ import octopusApi from "@saooti/octopus-api";
|
|
|
2
2
|
import { defineComponent } from "vue";
|
|
3
3
|
import { usePlayerStore } from "@/stores/PlayerStore";
|
|
4
4
|
import { mapState, mapActions } from "pinia";
|
|
5
|
+
import { AdserverOtherEmission } from "@/stores/class/adserver/adserverOtherEmission";
|
|
5
6
|
export const playerTranscript = defineComponent({
|
|
6
7
|
computed: {
|
|
7
|
-
...mapState(usePlayerStore, ["playerTranscript", "playerPodcast"]),
|
|
8
|
+
...mapState(usePlayerStore, ["playerTranscript", "playerPodcast", 'playerDelayStitching']),
|
|
8
9
|
},
|
|
9
10
|
methods: {
|
|
10
|
-
...mapActions(usePlayerStore, ["playerUpdateTranscript"]),
|
|
11
|
+
...mapActions(usePlayerStore, ["playerUpdateTranscript", "playerUpdateDelayStitching"]),
|
|
12
|
+
async checkDelaytWithStitching(){
|
|
13
|
+
this.playerUpdateDelayStitching(0);
|
|
14
|
+
const audioPlayer = document.querySelector("#audio-player") as HTMLAudioElement;
|
|
15
|
+
if (!this.playerTranscript || !audioPlayer || !this.playerPodcast ||
|
|
16
|
+
audioPlayer.duration <= this.playerPodcast.duration / 1000 + 5)
|
|
17
|
+
{
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
let adserverConfig = await octopusApi.fetchDataPublic<AdserverOtherEmission>(0,`ad/test/podcast/${this.playerPodcast.podcastId}`);
|
|
21
|
+
const doubletsLength = adserverConfig.config.doublets.length;
|
|
22
|
+
if(1=== doubletsLength && "pre" === adserverConfig.config.doublets[0].timing.insertion){
|
|
23
|
+
this.playerUpdateDelayStitching( audioPlayer.duration - (this.playerPodcast.duration / 1000));
|
|
24
|
+
}else if(0===doubletsLength || 1=== doubletsLength && "post" === adserverConfig.config.doublets[0].timing.insertion){
|
|
25
|
+
return;
|
|
26
|
+
}else{
|
|
27
|
+
// todo remove chaptering
|
|
28
|
+
this.playerUpdateChaptering();
|
|
29
|
+
this.playerUpdateTranscript();
|
|
30
|
+
}
|
|
31
|
+
},
|
|
11
32
|
async getTranscription(): Promise<void> {
|
|
12
33
|
if (!this.playerPodcast) {
|
|
13
34
|
this.playerUpdateTranscript();
|
|
@@ -20,10 +41,13 @@ export const playerTranscript = defineComponent({
|
|
|
20
41
|
const arrayTranscript = this.parseSrt(result);
|
|
21
42
|
const actualText =
|
|
22
43
|
arrayTranscript?.[0]?.startTime === 0 ? arrayTranscript[0].text : "";
|
|
44
|
+
if(!arrayTranscript){
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
23
47
|
this.playerUpdateTranscript({
|
|
24
48
|
actual: 0,
|
|
25
49
|
actualText: actualText,
|
|
26
|
-
value: arrayTranscript
|
|
50
|
+
value: arrayTranscript
|
|
27
51
|
});
|
|
28
52
|
},
|
|
29
53
|
parseSrt(transcript: string) {
|
|
@@ -52,23 +76,30 @@ export const playerTranscript = defineComponent({
|
|
|
52
76
|
return +a[0] * 60 * 60 + +a[1] * 60 + +parseFloat(a[2]);
|
|
53
77
|
},
|
|
54
78
|
onTimeUpdateTranscript(currentTime: number) {
|
|
79
|
+
if(!this.playerTranscript || !this.playerTranscript.value.length){
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const startTime = (this.playerTranscript.value[this.playerTranscript.actual]?.startTime ?? 0) + this.playerDelayStitching;
|
|
83
|
+
if (startTime <= currentTime) {
|
|
84
|
+
this.playerTranscript.actualText = this.playerTranscript.value[this.playerTranscript?.actual]?.text ??"";
|
|
85
|
+
}
|
|
55
86
|
if (
|
|
56
|
-
this.playerTranscript
|
|
57
|
-
|
|
58
|
-
Infinity) < currentTime
|
|
87
|
+
(this.playerTranscript.value[this.playerTranscript.actual]?.endTime ??
|
|
88
|
+
Infinity) + this.playerDelayStitching < currentTime
|
|
59
89
|
) {
|
|
60
90
|
this.playerTranscript.actual += 1;
|
|
61
91
|
this.playerTranscript.actualText =
|
|
62
|
-
this.playerTranscript?.value[this.playerTranscript
|
|
92
|
+
this.playerTranscript?.value[this.playerTranscript.actual]?.text ??
|
|
63
93
|
"";
|
|
64
94
|
}
|
|
65
95
|
},
|
|
96
|
+
|
|
66
97
|
onSeekedTranscript(currentTime: number) {
|
|
67
98
|
if (this.playerTranscript) {
|
|
68
99
|
let newActual = 0;
|
|
69
100
|
while (
|
|
70
101
|
currentTime >
|
|
71
|
-
(this.playerTranscript.value[newActual]?.endTime ?? Infinity)
|
|
102
|
+
(this.playerTranscript.value[newActual]?.endTime ?? Infinity) + this.playerDelayStitching
|
|
72
103
|
) {
|
|
73
104
|
newActual += 1;
|
|
74
105
|
}
|
|
@@ -20,15 +20,24 @@
|
|
|
20
20
|
/>
|
|
21
21
|
</div>
|
|
22
22
|
|
|
23
|
+
<button
|
|
24
|
+
v-if="authenticated"
|
|
25
|
+
class="btn btn-primary"
|
|
26
|
+
@click="logoutFunction"
|
|
27
|
+
|
|
28
|
+
>{{ authText }}</button
|
|
29
|
+
>
|
|
23
30
|
<a
|
|
31
|
+
v-else
|
|
24
32
|
class="btn btn-primary"
|
|
25
|
-
|
|
33
|
+
href="/sso/login"
|
|
26
34
|
>{{ authText }}</a
|
|
27
35
|
>
|
|
28
36
|
</div>
|
|
29
37
|
</template>
|
|
30
38
|
|
|
31
39
|
<script lang="ts">
|
|
40
|
+
import octopusApi from "@saooti/octopus-api";
|
|
32
41
|
import { state } from "../../stores/ParamSdkStore";
|
|
33
42
|
import { useGeneralStore } from "@/stores/GeneralStore";
|
|
34
43
|
import { mapState } from "pinia";
|
|
@@ -47,6 +56,16 @@ export default defineComponent({
|
|
|
47
56
|
mounted() {
|
|
48
57
|
document.title = this.metaTitle;
|
|
49
58
|
},
|
|
59
|
+
methods:{
|
|
60
|
+
async logoutFunction(){
|
|
61
|
+
try {
|
|
62
|
+
await octopusApi.postDataPublic(4, '/logout', undefined);
|
|
63
|
+
this.$router.push('/');
|
|
64
|
+
} catch (error) {
|
|
65
|
+
//Do nothing
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
50
69
|
});
|
|
51
70
|
</script>
|
|
52
71
|
<style lang="scss">
|
|
@@ -25,6 +25,7 @@ interface PlayerState {
|
|
|
25
25
|
playerLargeVersion: boolean;
|
|
26
26
|
playerVideo: boolean;
|
|
27
27
|
playerChaptering?: Chaptering;
|
|
28
|
+
playerDelayStitching: number;
|
|
28
29
|
}
|
|
29
30
|
export const usePlayerStore = defineStore("PlayerStore", {
|
|
30
31
|
state: (): PlayerState => ({
|
|
@@ -40,6 +41,7 @@ export const usePlayerStore = defineStore("PlayerStore", {
|
|
|
40
41
|
playerLargeVersion: false,
|
|
41
42
|
playerVideo: false,
|
|
42
43
|
playerChaptering: undefined,
|
|
44
|
+
playerDelayStitching:0,
|
|
43
45
|
}),
|
|
44
46
|
getters: {
|
|
45
47
|
playerChapteringPercent(): ChapteringPercent|undefined{
|
|
@@ -48,10 +50,11 @@ export const usePlayerStore = defineStore("PlayerStore", {
|
|
|
48
50
|
}
|
|
49
51
|
let chapteringPercent: ChapteringPercent = [];
|
|
50
52
|
for (let i = 0, len = this.playerChaptering.chapters.length; i < len; i++) {
|
|
53
|
+
const startTimeWithDelay = this.playerChaptering.chapters[i].startTime + Math.floor(this.playerDelayStitching);
|
|
51
54
|
chapteringPercent.push({
|
|
52
|
-
startTime :
|
|
53
|
-
startDisplay: DurationHelper.formatDuration(
|
|
54
|
-
startPercent: (
|
|
55
|
+
startTime : startTimeWithDelay,
|
|
56
|
+
startDisplay: DurationHelper.formatDuration(startTimeWithDelay, ':', false),
|
|
57
|
+
startPercent: (startTimeWithDelay * 100 ) / (Math.round(this.playerTotal)),
|
|
55
58
|
endPercent:100,
|
|
56
59
|
title: this.playerChaptering.chapters[i].title
|
|
57
60
|
});
|
|
@@ -202,8 +205,14 @@ export const usePlayerStore = defineStore("PlayerStore", {
|
|
|
202
205
|
playerUpdateTranscript(transcript?: Transcript) {
|
|
203
206
|
this.playerTranscript = transcript;
|
|
204
207
|
},
|
|
208
|
+
playerUpdateDelayStitching(delay: number){
|
|
209
|
+
this.playerDelayStitching = delay;
|
|
210
|
+
},
|
|
205
211
|
playerUpdateLargeVersion(largeVersion: boolean) {
|
|
206
212
|
this.playerLargeVersion = largeVersion;
|
|
207
213
|
},
|
|
214
|
+
playerUpdateChaptering(chaptering?: Chaptering){
|
|
215
|
+
this.playerChaptering = chaptering;
|
|
216
|
+
}
|
|
208
217
|
},
|
|
209
218
|
});
|