@saooti/octopus-sdk 40.0.3 → 40.1.0
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/index.ts +31 -31
- package/package.json +1 -1
- package/plateform.conf +1 -1
- package/src/App.vue +9 -3
- package/src/api/classicApi.ts +1 -1
- package/src/components/composable/player/usePlayerDisplayTime.ts +33 -0
- package/src/components/composable/player/usePlayerLive.ts +150 -0
- package/src/components/composable/player/usePlayerLogic.ts +265 -0
- package/src/components/composable/player/usePlayerLogicProgress.ts +135 -0
- package/src/components/composable/player/usePlayerStitching.ts +213 -0
- package/src/components/composable/player/usePlayerTranscript.ts +120 -0
- package/src/components/composable/player/usePlayerVast.ts +207 -0
- package/src/components/composable/podcasts/useCountdown.ts +53 -0
- package/src/components/composable/podcasts/usePodcastView.ts +85 -0
- package/src/components/composable/radio/usefetchRadioData.ts +75 -0
- package/src/components/composable/route/useAdvancedParamInit.ts +165 -0
- package/src/components/composable/route/useRouteUpdateParams.ts +48 -0
- package/src/components/composable/route/useRubriquesFilterComputed.ts +24 -0
- package/src/components/composable/route/useRubriquesFilterParam.ts +32 -0
- package/src/components/composable/route/useSeoTitleUrl.ts +30 -0
- package/src/components/composable/route/useSimplePageParam.ts +50 -0
- package/src/components/composable/useErrorHandler.ts +25 -0
- package/src/components/composable/useImageProxy.ts +28 -0
- package/src/components/composable/useInit.ts +38 -0
- package/src/components/composable/useMetaTitle.ts +19 -0
- package/src/components/composable/useMetaTitleWatch.ts +14 -0
- package/src/components/composable/useOrgaComputed.ts +23 -0
- package/src/components/composable/useOrganisationFilter.ts +65 -0
- package/src/components/composable/useResizePhone.ts +27 -0
- package/src/components/composable/useSelenium.ts +10 -0
- package/src/components/composable/useTagOf.ts +21 -0
- package/src/components/display/accessibility/AccessibilityModal.vue +136 -0
- package/src/components/display/aggregator/RssSection.vue +1 -4
- package/src/components/display/categories/CategoryChooser.vue +1 -1
- package/src/components/display/categories/CategoryFilter.vue +7 -3
- package/src/components/display/categories/CategoryList.vue +5 -2
- package/src/components/display/comments/CommentInput.vue +0 -3
- package/src/components/display/comments/CommentList.vue +6 -2
- package/src/components/display/comments/CommentPlayer.vue +5 -2
- package/src/components/display/comments/CommentSection.vue +0 -2
- package/src/components/display/comments/item/CommentBasicView.vue +4 -4
- package/src/components/display/comments/item/CommentItem.vue +0 -4
- package/src/components/display/comments/item/CommentMoreActions.vue +6 -2
- package/src/components/display/emission/EmissionInlineList.vue +6 -6
- package/src/components/display/emission/EmissionItem.vue +13 -6
- package/src/components/display/emission/EmissionList.vue +5 -2
- package/src/components/display/emission/EmissionPlayerItem.vue +8 -5
- package/src/components/display/emission/EmissionPresentationItem.vue +16 -7
- package/src/components/display/emission/EmissionPresentationList.vue +10 -7
- package/src/components/display/filter/AdvancedSearch.vue +9 -6
- package/src/components/display/filter/CategorySearchFilter.vue +0 -2
- package/src/components/display/filter/ProductorSearch.vue +8 -3
- package/src/components/display/filter/RubriqueFilter.vue +6 -2
- package/src/components/display/list/ListPaginate.vue +9 -6
- package/src/components/display/list/SwiperList.vue +6 -5
- package/src/components/display/live/CountDown.vue +7 -15
- package/src/components/display/live/CountdownOctopus.vue +10 -30
- package/src/components/display/live/LiveItem.vue +0 -2
- package/src/components/display/live/LiveList.vue +9 -4
- package/src/components/display/live/RadioCurrently.vue +9 -5
- package/src/components/display/live/RadioImage.vue +6 -4
- package/src/components/display/live/RadioItem.vue +1 -2
- package/src/components/display/live/RadioList.vue +5 -3
- package/src/components/display/live/RadioPlanning.vue +10 -7
- package/src/components/display/organisation/OrganisationChooser.vue +8 -4
- package/src/components/display/participant/ParticipantInlineList.vue +5 -5
- package/src/components/display/participant/ParticipantItem.vue +13 -5
- package/src/components/display/participant/ParticipantList.vue +6 -3
- package/src/components/display/playlist/PlaylistItem.vue +12 -5
- package/src/components/display/playlist/PlaylistList.vue +6 -3
- package/src/components/display/playlist/PodcastList.vue +8 -4
- package/src/components/display/podcastmaker/PodcastmakerHeader.vue +6 -3
- package/src/components/display/podcasts/DownloadPodcastButton.vue +2 -4
- package/src/components/display/podcasts/PodcastImage.vue +6 -3
- package/src/components/display/podcasts/PodcastInlineListTemplate.vue +7 -4
- package/src/components/display/podcasts/PodcastItem.vue +1 -1
- package/src/components/display/podcasts/PodcastItemInfo.vue +6 -3
- package/src/components/display/podcasts/PodcastList.vue +6 -3
- package/src/components/display/podcasts/PodcastModuleBox.vue +22 -9
- package/src/components/display/podcasts/PodcastPlayBar.vue +1 -3
- package/src/components/display/podcasts/PodcastPlayButton.vue +1 -3
- package/src/components/display/podcasts/PodcastRawTranscript.vue +79 -10
- package/src/components/display/podcasts/PodcastRubriqueList.vue +4 -3
- package/src/components/display/podcasts/TagList.vue +5 -2
- package/src/components/display/podcasts/VideoModuleBox.vue +6 -3
- package/src/components/display/rubriques/RubriqueChooser.vue +0 -2
- package/src/components/display/rubriques/RubriqueList.vue +7 -5
- package/src/components/display/sharing/ShareButtons.vue +4 -2
- package/src/components/display/sharing/ShareDistribution.vue +4 -2
- package/src/components/form/ClassicEmojiPicker.vue +5 -3
- package/src/components/misc/ClassicLazy.vue +2 -2
- package/src/components/misc/FooterGarSection.vue +2 -3
- package/src/components/misc/FooterSection.vue +9 -5
- package/src/components/misc/MobileMenu.vue +5 -3
- package/src/components/misc/TopBar.vue +8 -6
- package/src/components/misc/TopBarMainContent.vue +8 -4
- package/src/components/misc/modal/ClassicModalInBody.vue +2 -3
- package/src/components/misc/modal/ClipboardModal.vue +4 -3
- package/src/components/misc/modal/NewsletterModal.vue +4 -3
- package/src/components/misc/modal/ShareModalPlayer.vue +4 -2
- package/src/components/misc/player/PlayerCompact.vue +30 -41
- package/src/components/misc/player/PlayerComponent.vue +69 -84
- package/src/components/misc/player/PlayerLarge.vue +43 -58
- package/src/components/misc/player/elements/PlayerImage.vue +6 -3
- package/src/components/misc/player/elements/PlayerTitle.vue +6 -2
- package/src/components/misc/player/radio/RadioHistory.vue +2 -4
- package/src/components/misc/player/video/PlayerVideoHls.vue +6 -7
- package/src/components/pages/EmissionPage.vue +19 -7
- package/src/components/pages/EmissionsPage.vue +31 -23
- package/src/components/pages/HomePage.vue +5 -2
- package/src/components/pages/PageLogout.vue +0 -2
- package/src/components/pages/PageNotFound.vue +11 -15
- package/src/components/pages/ParticipantPage.vue +18 -7
- package/src/components/pages/ParticipantsPage.vue +16 -21
- package/src/components/pages/PlaylistPage.vue +18 -7
- package/src/components/pages/PlaylistsPage.vue +20 -29
- package/src/components/pages/PodcastPage.vue +12 -6
- package/src/components/pages/PodcastsPage.vue +46 -48
- package/src/components/pages/RadioPage.vue +9 -6
- package/src/components/pages/RubriquePage.vue +41 -52
- package/src/components/pages/VideoPage.vue +152 -166
- package/src/helper/cookiesHelper.ts +20 -0
- package/src/helper/displayHelper.ts +15 -0
- package/src/helper/downloadHelper.ts +30 -0
- package/src/helper/{fetch.ts → fetchHelper.ts} +0 -1
- package/src/helper/loadScript.ts +22 -0
- package/src/helper/radio/radioHelper.ts +15 -0
- package/src/helper/{string.ts → stringHelper.ts} +5 -0
- package/src/locale/de.ts +4 -0
- package/src/locale/en.ts +4 -0
- package/src/locale/es.ts +4 -0
- package/src/locale/fr.ts +4 -0
- package/src/locale/it.ts +4 -0
- package/src/locale/sl.ts +4 -0
- package/src/stores/AuthStore.ts +1 -2
- package/src/stores/CommentStore.ts +8 -8
- package/src/stores/PlayerStore.ts +1 -1
- package/src/style/general.scss +15 -1
- package/src/components/mixins/cookies.ts +0 -22
- package/src/components/mixins/displayMethods.ts +0 -17
- package/src/components/mixins/download.ts +0 -33
- package/src/components/mixins/fetchParameters.ts +0 -16
- package/src/components/mixins/handle403.ts +0 -22
- package/src/components/mixins/imageProxy.ts +0 -28
- package/src/components/mixins/init.ts +0 -34
- package/src/components/mixins/loadScript.ts +0 -25
- package/src/components/mixins/metaTitle.ts +0 -15
- package/src/components/mixins/metaTitleWatch.ts +0 -26
- package/src/components/mixins/orgaComputed.ts +0 -23
- package/src/components/mixins/organisationFilter.ts +0 -56
- package/src/components/mixins/player/playerDisplayTime.ts +0 -35
- package/src/components/mixins/player/playerLive.ts +0 -144
- package/src/components/mixins/player/playerLogic.ts +0 -275
- package/src/components/mixins/player/playerLogicProgress.ts +0 -135
- package/src/components/mixins/player/playerStitching.ts +0 -202
- package/src/components/mixins/player/playerTranscript.ts +0 -113
- package/src/components/mixins/player/playerVast.ts +0 -198
- package/src/components/mixins/podcast/countdown.ts +0 -45
- package/src/components/mixins/podcast/podcastView.ts +0 -63
- package/src/components/mixins/radio/fetchRadioData.ts +0 -77
- package/src/components/mixins/resizePhone.ts +0 -26
- package/src/components/mixins/routeParam/advancedParamInit.ts +0 -202
- package/src/components/mixins/routeParam/paginateParamInit.ts +0 -43
- package/src/components/mixins/routeParam/routeParams.ts +0 -33
- package/src/components/mixins/routeParam/rubriquesFilterComputed.ts +0 -22
- package/src/components/mixins/routeParam/rubriquesFilterParam.ts +0 -29
- package/src/components/mixins/selenium.ts +0 -7
- package/src/components/mixins/seoTitleUrl.ts +0 -26
- package/src/components/mixins/tagOfMixins.ts +0 -19
- package/src/helper/uuidGenerator.ts +0 -7
- /package/src/{helper → components/composable}/useEventListener.ts +0 -0
- /package/src/{components/mixins/debounce.ts → helper/debounceHelper.ts} +0 -0
- /package/src/helper/{dom.ts → domHelper.ts} +0 -0
- /package/src/helper/{duration.ts → durationHelper.ts} +0 -0
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
import classicApi from "../../../api/classicApi";
|
|
2
|
-
import { CommentPodcast } from "@/stores/class/general/comment";
|
|
3
|
-
import cookies from "../cookies";
|
|
4
|
-
import { playerLive } from "./playerLive";
|
|
5
|
-
import { playerTranscript } from "./playerTranscript";
|
|
6
|
-
import { playerStitching } from "./playerStitching";
|
|
7
|
-
import { defineComponent } from "vue";
|
|
8
|
-
import { useAuthStore } from "../../../stores/AuthStore";
|
|
9
|
-
import { useGeneralStore } from "../../../stores/GeneralStore";
|
|
10
|
-
import { usePlayerStore } from "../../../stores/PlayerStore";
|
|
11
|
-
import { mapState, mapActions } from "pinia";
|
|
12
|
-
import { FetchParam } from "@/stores/class/general/fetchParam";
|
|
13
|
-
import { useVastStore } from "../../../stores/VastStore";
|
|
14
|
-
import dayjs from "dayjs";
|
|
15
|
-
export const playerLogic = defineComponent({
|
|
16
|
-
mixins: [cookies, playerLive, playerTranscript, playerStitching],
|
|
17
|
-
data() {
|
|
18
|
-
return {
|
|
19
|
-
forceHide: false as boolean,
|
|
20
|
-
listenTime: 0 as number,
|
|
21
|
-
notListenTime: 0 as number,
|
|
22
|
-
lastSend: 0 as number,
|
|
23
|
-
downloadId: null as string | null,
|
|
24
|
-
playerError: false as boolean,
|
|
25
|
-
listenError: false as boolean,
|
|
26
|
-
percentLiveProgress: 0 as number,
|
|
27
|
-
durationLivePosition: 0 as number,
|
|
28
|
-
displayAlertBar: false as boolean,
|
|
29
|
-
hlsReady: false as boolean,
|
|
30
|
-
comments: [] as Array<CommentPodcast>,
|
|
31
|
-
showTimeline: false as boolean,
|
|
32
|
-
audioUrlToPlay: "" as string,
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
computed: {
|
|
36
|
-
...mapState(useAuthStore, ["authOrgaId", "authParam"]),
|
|
37
|
-
...mapState(useGeneralStore, ["consentTcf"]),
|
|
38
|
-
...mapState(usePlayerStore, [
|
|
39
|
-
"playerPodcast",
|
|
40
|
-
"playerMedia",
|
|
41
|
-
"playerLive",
|
|
42
|
-
"playerRadio",
|
|
43
|
-
"playerVolume",
|
|
44
|
-
"playerStatus",
|
|
45
|
-
"playerSeekTime",
|
|
46
|
-
"playerVideo"
|
|
47
|
-
]),
|
|
48
|
-
...mapState(useVastStore, ["useVastPlayerPodcast"]),
|
|
49
|
-
|
|
50
|
-
audioUrl(): string {
|
|
51
|
-
return this.getAudioUrl();
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
watch: {
|
|
56
|
-
async audioUrl(): Promise<void> {
|
|
57
|
-
this.playerError = false;
|
|
58
|
-
if (
|
|
59
|
-
this.playerMedia ||
|
|
60
|
-
!this.playerPodcast ||
|
|
61
|
-
this.playerVideo ||
|
|
62
|
-
!this.playerPodcast.availability.visibility ||
|
|
63
|
-
this.listenError
|
|
64
|
-
) {
|
|
65
|
-
this.audioUrlToPlay = this.audioUrl;
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
const response = await classicApi.fetchData<{
|
|
69
|
-
location: string;
|
|
70
|
-
downloadId: number;
|
|
71
|
-
}>({
|
|
72
|
-
api:0,
|
|
73
|
-
path:"podcast/download/register/"+this.playerPodcast.podcastId + ".mp3",
|
|
74
|
-
parameters:this.getAudioUrlParameters(),
|
|
75
|
-
headers: {'X-Extra-UA':'Saooti Player'},
|
|
76
|
-
isNotAuth:true
|
|
77
|
-
});
|
|
78
|
-
this.setDownloadId(response.downloadId.toString());
|
|
79
|
-
this.audioUrlToPlay = response.location;
|
|
80
|
-
},
|
|
81
|
-
playerPodcast: {
|
|
82
|
-
deep: true,
|
|
83
|
-
handler() {
|
|
84
|
-
this.reInitPlayer();
|
|
85
|
-
this.getTranscription();
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
playerLive: {
|
|
89
|
-
deep: true,
|
|
90
|
-
handler() {
|
|
91
|
-
if(this.playerVideo){
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
this.$nextTick(async () => {
|
|
95
|
-
this.hlsReady = false;
|
|
96
|
-
this.reInitPlayer();
|
|
97
|
-
this.playLive();
|
|
98
|
-
});
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
playerRadio() {
|
|
102
|
-
this.$nextTick(async () => {
|
|
103
|
-
this.hlsReady = false;
|
|
104
|
-
this.reInitPlayer();
|
|
105
|
-
this.playRadio();
|
|
106
|
-
});
|
|
107
|
-
},
|
|
108
|
-
playerStatus() {
|
|
109
|
-
const audioPlayer: HTMLAudioElement | null =
|
|
110
|
-
document.querySelector("#audio-player");
|
|
111
|
-
if (!audioPlayer) return;
|
|
112
|
-
if (this.playerLive && !this.hlsReady) {
|
|
113
|
-
audioPlayer.pause();
|
|
114
|
-
this.percentLiveProgress = 0;
|
|
115
|
-
this.durationLivePosition = 0;
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
if ("PAUSED" === this.playerStatus && this.playerRadio) {
|
|
119
|
-
this.playerRadio.dateSessionId = dayjs().toISOString();
|
|
120
|
-
this.hlsReady = false;
|
|
121
|
-
this.reInitPlayer();
|
|
122
|
-
this.endingLive();
|
|
123
|
-
} else if ("PAUSED" === this.playerStatus) {
|
|
124
|
-
audioPlayer.pause();
|
|
125
|
-
} else if ("PLAYING" === this.playerStatus && this.playerRadio) {
|
|
126
|
-
if (this.playerRadio.isInit) {
|
|
127
|
-
this.playRadio();
|
|
128
|
-
} else {
|
|
129
|
-
this.playerRadio.isInit = true;
|
|
130
|
-
}
|
|
131
|
-
} else if ("PLAYING" === this.playerStatus) {
|
|
132
|
-
audioPlayer.play();
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
methods: {
|
|
138
|
-
...mapActions(usePlayerStore, ["playerPlay", "playerUpdateElapsed"]),
|
|
139
|
-
getDomain(): string {
|
|
140
|
-
let domain = "";
|
|
141
|
-
const domainArray: RegExpExecArray | null = /\.(.+)/.exec(
|
|
142
|
-
window.location.host,
|
|
143
|
-
);
|
|
144
|
-
if (domainArray && null !== domainArray) {
|
|
145
|
-
domain = domainArray[1];
|
|
146
|
-
}
|
|
147
|
-
return domain;
|
|
148
|
-
},
|
|
149
|
-
getAudioUrlParameters(): FetchParam {
|
|
150
|
-
if (!this.playerPodcast) return {};
|
|
151
|
-
const parameters: FetchParam = {
|
|
152
|
-
origin: "octopus",
|
|
153
|
-
accepted: this.useVastPlayerPodcast
|
|
154
|
-
};
|
|
155
|
-
if (this.authOrgaId) {
|
|
156
|
-
parameters.distributorId = this.authOrgaId;
|
|
157
|
-
}
|
|
158
|
-
if (this.consentTcf) {
|
|
159
|
-
parameters.consent = this.consentTcf;
|
|
160
|
-
}
|
|
161
|
-
if (
|
|
162
|
-
"SECURED" === this.playerPodcast.organisation.privacy &&
|
|
163
|
-
this.authParam.accessToken
|
|
164
|
-
) {
|
|
165
|
-
parameters.access_token =this.authParam.accessToken;
|
|
166
|
-
}
|
|
167
|
-
return parameters;
|
|
168
|
-
},
|
|
169
|
-
getAudioUrl(): string {
|
|
170
|
-
if (this.playerMedia){
|
|
171
|
-
return this.playerMedia.audioUrl ? this.playerMedia.audioUrl : "";
|
|
172
|
-
}
|
|
173
|
-
if (!this.playerPodcast || this.playerVideo) return "";
|
|
174
|
-
if (
|
|
175
|
-
!this.playerPodcast.availability.visibility ||
|
|
176
|
-
"PROCESSING" === this.playerPodcast.processingStatus
|
|
177
|
-
)
|
|
178
|
-
return this.playerPodcast.audioStorageUrl;
|
|
179
|
-
if (this.listenError) return this.playerPodcast.audioStorageUrl;
|
|
180
|
-
return this.playerPodcast.podcastId + ".mp3?"+this.getAudioUrlParameters().toString();
|
|
181
|
-
},
|
|
182
|
-
reInitPlayer(): void {
|
|
183
|
-
this.setDownloadId(null);
|
|
184
|
-
this.listenError = false;
|
|
185
|
-
if (this.playerLive || this.playerRadio) {
|
|
186
|
-
this.endingLive();
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
stopPlayer(): void {
|
|
190
|
-
this.playerPlay();
|
|
191
|
-
},
|
|
192
|
-
onError(): void {
|
|
193
|
-
if (
|
|
194
|
-
this.playerPodcast &&
|
|
195
|
-
"" !== this.audioUrlToPlay &&
|
|
196
|
-
!this.listenError
|
|
197
|
-
) {
|
|
198
|
-
this.listenError = true;
|
|
199
|
-
} else if (
|
|
200
|
-
(this.playerPodcast && "" !== this.audioUrlToPlay) ||
|
|
201
|
-
this.playerMedia
|
|
202
|
-
) {
|
|
203
|
-
this.playerError = true;
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
streamDurationForSafari(mediaTarget: HTMLMediaElement) {
|
|
207
|
-
let streamDuration = mediaTarget.duration;
|
|
208
|
-
if (Infinity === streamDuration) {
|
|
209
|
-
const seekable = mediaTarget.seekable;
|
|
210
|
-
if (seekable) {
|
|
211
|
-
streamDuration = seekable.end(seekable.length - 1);
|
|
212
|
-
} else {
|
|
213
|
-
streamDuration = mediaTarget.currentTime;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
return streamDuration;
|
|
217
|
-
},
|
|
218
|
-
|
|
219
|
-
onTimeUpdatePodcast(streamDuration: number, currentTime: number) {
|
|
220
|
-
this.displayAlertBar = false;
|
|
221
|
-
this.percentLiveProgress = 0;
|
|
222
|
-
this.playerUpdateElapsed(currentTime / streamDuration, streamDuration);
|
|
223
|
-
this.onTimeUpdateTranscript(currentTime);
|
|
224
|
-
},
|
|
225
|
-
onTimeUpdateLive(streamDuration: number, currentTime: number) {
|
|
226
|
-
if (!this.playerLive) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
const scheduledDuration = this.playerLive.duration / 1000;
|
|
230
|
-
if (scheduledDuration > streamDuration) {
|
|
231
|
-
this.displayAlertBar = false;
|
|
232
|
-
this.percentLiveProgress = (streamDuration / scheduledDuration) * 100;
|
|
233
|
-
this.playerUpdateElapsed(
|
|
234
|
-
currentTime / scheduledDuration,
|
|
235
|
-
scheduledDuration,
|
|
236
|
-
);
|
|
237
|
-
} else {
|
|
238
|
-
this.percentLiveProgress = 100;
|
|
239
|
-
this.displayAlertBar = true;
|
|
240
|
-
this.durationLivePosition = (scheduledDuration / streamDuration) * 100;
|
|
241
|
-
this.playerUpdateElapsed(currentTime / streamDuration, streamDuration);
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
onTimeUpdate(event: Event): void {
|
|
245
|
-
if (this.playerRadio) {
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
const mediaTarget = event.currentTarget as HTMLMediaElement;
|
|
249
|
-
if (this.playerPodcast || this.playerLive) {
|
|
250
|
-
this.onTimeUpdateProgress(mediaTarget.currentTime);
|
|
251
|
-
}
|
|
252
|
-
const streamDuration = this.streamDurationForSafari(mediaTarget);
|
|
253
|
-
if (!streamDuration) return;
|
|
254
|
-
if (!mediaTarget.currentTime) return;
|
|
255
|
-
if (!this.playerLive) {
|
|
256
|
-
this.onTimeUpdatePodcast(streamDuration, mediaTarget.currentTime);
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
this.onTimeUpdateLive(streamDuration, mediaTarget.currentTime);
|
|
260
|
-
},
|
|
261
|
-
onSeeked(event: Event): void {
|
|
262
|
-
const mediaTarget = event.currentTarget as HTMLMediaElement;
|
|
263
|
-
const currentTime = mediaTarget.currentTime;
|
|
264
|
-
this.onSeekedTranscript(currentTime);
|
|
265
|
-
},
|
|
266
|
-
onFinished(): void {
|
|
267
|
-
this.setDownloadId(null);
|
|
268
|
-
this.contentEndedAdsLoader();
|
|
269
|
-
if (this.playerLive) {
|
|
270
|
-
this.endingLive();
|
|
271
|
-
}
|
|
272
|
-
this.forceHide = true;
|
|
273
|
-
},
|
|
274
|
-
},
|
|
275
|
-
});
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import classicApi from "../../../api/classicApi";
|
|
2
|
-
import { defineComponent } from "vue";
|
|
3
|
-
import { useAuthStore } from "../../../stores/AuthStore";
|
|
4
|
-
import { usePlayerStore } from "../../../stores/PlayerStore";
|
|
5
|
-
import { mapState } from "pinia";
|
|
6
|
-
export const playerLogicProgress = defineComponent({
|
|
7
|
-
mixins: [],
|
|
8
|
-
data() {
|
|
9
|
-
return {
|
|
10
|
-
listenTime: 0 as number,
|
|
11
|
-
notListenTime: 0 as number,
|
|
12
|
-
lastSend: 0 as number,
|
|
13
|
-
downloadId: null as string | null,
|
|
14
|
-
};
|
|
15
|
-
},
|
|
16
|
-
computed: {
|
|
17
|
-
...mapState(useAuthStore, ["authOrgaId"]),
|
|
18
|
-
...mapState(usePlayerStore, [
|
|
19
|
-
"playerPodcast",
|
|
20
|
-
"playerLive",
|
|
21
|
-
"playerRadio",
|
|
22
|
-
"playerSeekTime",
|
|
23
|
-
"playerVideo"
|
|
24
|
-
]),
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
watch: {
|
|
28
|
-
async listenTime(newVal): Promise<void> {
|
|
29
|
-
if (
|
|
30
|
-
(this.playerRadio && !this.playerPodcast && !this.playerLive) ||
|
|
31
|
-
!this.downloadId ||
|
|
32
|
-
newVal - this.lastSend < 10
|
|
33
|
-
) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
this.lastSend = newVal;
|
|
37
|
-
await classicApi.putData({
|
|
38
|
-
api: 0,
|
|
39
|
-
path:"podcast/listen/" + this.downloadId + "?seconds=" + Math.round(newVal),
|
|
40
|
-
isNotAuth:true
|
|
41
|
-
});
|
|
42
|
-
},
|
|
43
|
-
playerSeekTime() {
|
|
44
|
-
if (undefined===this.playerSeekTime) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (this.playerPodcast || this.playerLive) {
|
|
48
|
-
this.notListenTime = this.playerSeekTime - this.listenTime;
|
|
49
|
-
}
|
|
50
|
-
if(this.playerVideo){
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
const audioPlayer: HTMLAudioElement | null = document.querySelector("#audio-player");
|
|
54
|
-
if (!audioPlayer) return;
|
|
55
|
-
audioPlayer.currentTime = this.playerSeekTime;
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
mounted() {
|
|
60
|
-
window.addEventListener("beforeunload", this.endListeningProgress);
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
methods: {
|
|
64
|
-
async initLiveDownloadId() {
|
|
65
|
-
if (!this.playerLive || this.downloadId) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
try {
|
|
69
|
-
const mediaType = this.playerVideo ? "VIDEO":"AUDIO";
|
|
70
|
-
const downloadId = await classicApi.putData<string | null>({
|
|
71
|
-
api: 0,
|
|
72
|
-
path:"podcast/prepare/live/" + this.playerLive.podcastId+"?mediaType="+mediaType,
|
|
73
|
-
isNotAuth:true
|
|
74
|
-
});
|
|
75
|
-
await classicApi.fetchData<string | null>({
|
|
76
|
-
api:0,
|
|
77
|
-
path: "podcast/download/live/" + this.playerLive.podcastId + ".m3u8",
|
|
78
|
-
parameters:{
|
|
79
|
-
downloadId: downloadId ?? undefined,
|
|
80
|
-
origin: "octopus",
|
|
81
|
-
distributorId: this.authOrgaId,
|
|
82
|
-
},
|
|
83
|
-
isNotAuth:true
|
|
84
|
-
});
|
|
85
|
-
this.setDownloadId(downloadId);
|
|
86
|
-
} catch {
|
|
87
|
-
this.downloadId = null;
|
|
88
|
-
console.log("ERROR downloadId");
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
onTimeUpdateProgress(currentTime: number): void {
|
|
92
|
-
if (!this.downloadId) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (
|
|
96
|
-
this.playerLive &&
|
|
97
|
-
0 === this.listenTime &&
|
|
98
|
-
0 !== currentTime
|
|
99
|
-
) {
|
|
100
|
-
this.notListenTime = currentTime;
|
|
101
|
-
this.listenTime = 1;
|
|
102
|
-
} else {
|
|
103
|
-
const newListenTime = currentTime - this.notListenTime;
|
|
104
|
-
const diffTime = newListenTime - this.listenTime;
|
|
105
|
-
if(diffTime > 0 && diffTime<1){
|
|
106
|
-
this.listenTime = newListenTime;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
setDownloadId(newValue: string | null): void {
|
|
111
|
-
this.endListeningProgress();
|
|
112
|
-
this.downloadId = newValue;
|
|
113
|
-
},
|
|
114
|
-
async endListeningProgress(): Promise<void> {
|
|
115
|
-
if (!this.downloadId) return;
|
|
116
|
-
try {
|
|
117
|
-
await classicApi.putData<string | null>({
|
|
118
|
-
api: 0,
|
|
119
|
-
path:"podcast/listen/" +
|
|
120
|
-
this.downloadId +
|
|
121
|
-
"?seconds=" +
|
|
122
|
-
Math.round(this.listenTime),
|
|
123
|
-
isNotAuth:true
|
|
124
|
-
});
|
|
125
|
-
} catch {
|
|
126
|
-
//Do nothing
|
|
127
|
-
}
|
|
128
|
-
this.downloadId = null;
|
|
129
|
-
this.notListenTime = 0;
|
|
130
|
-
this.lastSend = 0;
|
|
131
|
-
this.listenTime = 0;
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
},
|
|
135
|
-
});
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import { defineComponent } from "vue";
|
|
2
|
-
import classicApi from "../../../api/classicApi";
|
|
3
|
-
import dayjs from "dayjs";
|
|
4
|
-
import { playerVast } from "./playerVast";
|
|
5
|
-
import { usePlayerStore } from "../../../stores/PlayerStore";
|
|
6
|
-
import { useSaveFetchStore } from "../../../stores/SaveFetchStore";
|
|
7
|
-
import { useVastStore } from "../../../stores/VastStore";
|
|
8
|
-
import { mapState, mapActions } from "pinia";
|
|
9
|
-
import { AdserverOtherEmission } from "@/stores/class/adserver/adserverOtherEmission";
|
|
10
|
-
import { AdserverTiming } from "@/stores/class/adserver/adserverTiming";
|
|
11
|
-
import { AdPosition } from "@/stores/class/adserver/adPosition";
|
|
12
|
-
import fetchParameters from "../fetchParameters";
|
|
13
|
-
|
|
14
|
-
export const playerStitching = defineComponent({
|
|
15
|
-
mixins:[playerVast,fetchParameters],
|
|
16
|
-
data() {
|
|
17
|
-
return {
|
|
18
|
-
radioInterval: undefined as ReturnType<typeof setTimeout> | undefined,
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
computed: {
|
|
22
|
-
...mapState(useVastStore, ["adPositionsPodcasts", "adPositionIndex", "useVastPlayerPodcast"]),
|
|
23
|
-
...mapState(usePlayerStore, ["playerElapsedSeconds", "playerRadio", "playerPodcast"]),
|
|
24
|
-
radioNextAdvertisingStartDate(){
|
|
25
|
-
return this.playerRadio?.nextAdvertising?.startDate;
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
watch:{
|
|
29
|
-
playerCurrentChange(): void {
|
|
30
|
-
if(this.playerCurrentChange && this.playerCurrentChange > 0 && !this.checkUsePlayerPodcastStitching()){return;}
|
|
31
|
-
this.onPlayerChange();
|
|
32
|
-
},
|
|
33
|
-
//launch advertising for podcast
|
|
34
|
-
playerElapsedSeconds():void{
|
|
35
|
-
if(!this.checkUsePlayerPodcastStitching()){return;}
|
|
36
|
-
if(!this.isAdRequested && this.checkAdNeedToBeLaunch()){
|
|
37
|
-
this.onRequestAd(this.adPositionsPodcasts[this.playerCurrentChange??0][this.adPositionIndex].vastUrl);
|
|
38
|
-
this.updateAdPositionIndex(this.adPositionIndex+1);
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
// launch advertising for radio
|
|
42
|
-
radioNextAdvertisingStartDate: {
|
|
43
|
-
immediate: true,
|
|
44
|
-
handler() {
|
|
45
|
-
if(!this.radioNextAdvertisingStartDate){
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
this.defineRadioInterval();
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
mounted(){
|
|
54
|
-
this.updateuseVastPlayerPodcast("true"===this.$route.query.vast);
|
|
55
|
-
},
|
|
56
|
-
methods: {
|
|
57
|
-
...mapActions(useSaveFetchStore, ["getOrgaAttributes"]),
|
|
58
|
-
...mapActions(useVastStore, ["updateAdPositionsPodcasts", "updateAdPositionIndex", "updateuseVastPlayerPodcast"]),
|
|
59
|
-
checkUsePlayerPodcastStitching():boolean{
|
|
60
|
-
return this.useVastPlayerPodcast;
|
|
61
|
-
},
|
|
62
|
-
defineRadioInterval(){
|
|
63
|
-
this.clearRadioInterval();
|
|
64
|
-
const timeRemaining = dayjs(this.radioNextAdvertisingStartDate).diff(dayjs(), "millisecond");
|
|
65
|
-
console.log("TimeRemaining "+timeRemaining);
|
|
66
|
-
if(timeRemaining < 0){
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
this.radioInterval = setTimeout(() => {
|
|
70
|
-
this.radioIntervalExecute();
|
|
71
|
-
}, timeRemaining);
|
|
72
|
-
},
|
|
73
|
-
async radioIntervalExecute(){
|
|
74
|
-
//If pause when ad needs to be played then skipped (TO THINK)
|
|
75
|
-
if("PAUSED"===this.playerStatus){return;}
|
|
76
|
-
const vastUrl = await this.getVastUrl(this.playerRadio?.nextAdvertising?.tag ??"5e385e1b51c86", this.playerRadio?.nextAdvertising?.adCount ?? 1);
|
|
77
|
-
console.log("vastUrl "+vastUrl);
|
|
78
|
-
this.onRequestAd(vastUrl);
|
|
79
|
-
},
|
|
80
|
-
clearRadioInterval() {
|
|
81
|
-
clearInterval(this.radioInterval as unknown as number);
|
|
82
|
-
this.radioInterval = undefined;
|
|
83
|
-
},
|
|
84
|
-
checkAdNeedToBeLaunch(){
|
|
85
|
-
if(!this.playerCurrentChange || !this.adPositionsPodcasts[this.playerCurrentChange]?.[this.adPositionIndex]){return false;}
|
|
86
|
-
return this.adPositionsPodcasts[this.playerCurrentChange][this.adPositionIndex]?.seconds <= this.playerElapsedSeconds;
|
|
87
|
-
},
|
|
88
|
-
async onPlayerChange(){
|
|
89
|
-
this.destroyAdManager();
|
|
90
|
-
if(null==this.playerCurrentChange){return;}
|
|
91
|
-
this.prepareIMA();
|
|
92
|
-
await this.fetchPodcastAdConfig();
|
|
93
|
-
},
|
|
94
|
-
async fetchPodcastAdConfig(){
|
|
95
|
-
if(!this.playerCurrentChange || !this.playerPodcast ||(this.playerCurrentChange && this.adPositionsPodcasts[this.playerCurrentChange])){
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const adserverConfig = await classicApi.fetchData<AdserverOtherEmission>({
|
|
99
|
-
api:0,
|
|
100
|
-
path: `ad/test/podcast/${this.playerCurrentChange}`,
|
|
101
|
-
isNotAuth:true
|
|
102
|
-
});
|
|
103
|
-
if(!adserverConfig || "SOUNDCAST_VAST"!==adserverConfig.config?.server){
|
|
104
|
-
this.updateAdPositionsPodcasts(this.playerCurrentChange, []);
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const podcastDurationSeconds = Math.round((this.playerPodcast?.duration??0) / 1000);
|
|
108
|
-
const allAdPositions =this.generateAllAdPositions(adserverConfig.config.doublets, podcastDurationSeconds);
|
|
109
|
-
const selectedAdPositions = await this.selectCorrectAdPositions(allAdPositions, podcastDurationSeconds, adserverConfig.config.minIntervalDuration, adserverConfig.config.minTailDuration);
|
|
110
|
-
this.updateAdPositionsPodcasts(this.playerCurrentChange, selectedAdPositions);
|
|
111
|
-
},
|
|
112
|
-
generateAllAdPositions(doublets: Array<AdserverTiming>, podcastDuration: number): Array<AdPosition>{
|
|
113
|
-
const adPositions: Array<AdPosition> = [];
|
|
114
|
-
if(doublets.some((element: AdserverTiming)=>{return "TAG_NO_AD"===element.tag})){
|
|
115
|
-
return [];
|
|
116
|
-
}
|
|
117
|
-
for (const doublet of doublets) {
|
|
118
|
-
if(!doublet.tag){continue;}
|
|
119
|
-
let seconds = 0;
|
|
120
|
-
if("post"===doublet.timing.insertion){
|
|
121
|
-
seconds = podcastDuration;
|
|
122
|
-
}else if("mid"===doublet.timing.insertion){
|
|
123
|
-
const mesure = doublet.timing.mesure ?? 0;
|
|
124
|
-
switch (doublet.timing.unit){
|
|
125
|
-
case "MILLISECOND": seconds = mesure * 1000; break;
|
|
126
|
-
case "MINUTE": seconds = Math.round(mesure / 60); break;
|
|
127
|
-
case "PERCENT": seconds = Math.round((mesure * podcastDuration) / 100); break;
|
|
128
|
-
default: seconds = mesure; break;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
adPositions.push({
|
|
132
|
-
impressId: doublet.tag,
|
|
133
|
-
policy: doublet.timing.insertion,
|
|
134
|
-
seconds: seconds,
|
|
135
|
-
vastUrl: ""
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
return adPositions.sort((a: AdPosition, b: AdPosition) => {
|
|
139
|
-
if (a.seconds > b.seconds) {
|
|
140
|
-
return 1;
|
|
141
|
-
}
|
|
142
|
-
return b.seconds > a.seconds ? -1 : 0;
|
|
143
|
-
});
|
|
144
|
-
},
|
|
145
|
-
async selectCorrectAdPositions(allAdPositions: Array<AdPosition>, podcastDuration: number, minIntervalDuration:number, minTailDuration:number): Promise<Array<AdPosition>>{
|
|
146
|
-
const adPositions: Array<AdPosition> = [];
|
|
147
|
-
let previousPosition = -1;
|
|
148
|
-
for(const adPosition of allAdPositions){
|
|
149
|
-
switch (adPosition.policy) {
|
|
150
|
-
case "pre":
|
|
151
|
-
adPositions.push(await this.defineVastUrl(adPosition));
|
|
152
|
-
previousPosition = 0;
|
|
153
|
-
break;
|
|
154
|
-
case "mid":
|
|
155
|
-
if (adPosition.seconds > podcastDuration - minTailDuration) {
|
|
156
|
-
//Too close to end
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
if (previousPosition >= 0 && adPosition.seconds < previousPosition + minIntervalDuration) {
|
|
160
|
-
//Too close to previous ad
|
|
161
|
-
continue;
|
|
162
|
-
}
|
|
163
|
-
adPositions.push(await this.defineVastUrl(adPosition));
|
|
164
|
-
previousPosition = adPosition.seconds;
|
|
165
|
-
break;
|
|
166
|
-
case "post":
|
|
167
|
-
if (previousPosition >= 0 && previousPosition > podcastDuration - minIntervalDuration) {
|
|
168
|
-
//Too close to previous ad
|
|
169
|
-
continue;
|
|
170
|
-
}
|
|
171
|
-
adPositions.push(await this.defineVastUrl(adPosition));
|
|
172
|
-
break;
|
|
173
|
-
default:break;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return adPositions;
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
async defineVastUrl(adPosition: AdPosition): Promise<AdPosition>{
|
|
180
|
-
adPosition.vastUrl = await this.getVastUrl(adPosition.impressId, 1);
|
|
181
|
-
return adPosition;
|
|
182
|
-
},
|
|
183
|
-
async getVastUrl(tag: string, adCount: number): Promise<string>{
|
|
184
|
-
const baseUrl = "https://api.soundcast.io/v1/vast/"+tag;
|
|
185
|
-
let keywords: Array<string> = [];
|
|
186
|
-
if(this.playerPodcast?.tags?.length){
|
|
187
|
-
const attributes = await this.getOrgaAttributes(this.playerPodcast.organisation.id);
|
|
188
|
-
if ("true"===attributes["AD_CONFIG_PODCAST_TAG"]) {
|
|
189
|
-
keywords = this.playerPodcast.tags.map((e) => {
|
|
190
|
-
return "tag:" + e;
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
const parameters = this.getUriSearchParams({
|
|
195
|
-
adCount: adCount ?? 1,
|
|
196
|
-
pageUrl:document.referrer,
|
|
197
|
-
keywords:keywords
|
|
198
|
-
});
|
|
199
|
-
return baseUrl + '?' + parameters.toString();
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
});
|