@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.
Files changed (174) hide show
  1. package/index.ts +31 -31
  2. package/package.json +1 -1
  3. package/plateform.conf +1 -1
  4. package/src/App.vue +9 -3
  5. package/src/api/classicApi.ts +1 -1
  6. package/src/components/composable/player/usePlayerDisplayTime.ts +33 -0
  7. package/src/components/composable/player/usePlayerLive.ts +150 -0
  8. package/src/components/composable/player/usePlayerLogic.ts +265 -0
  9. package/src/components/composable/player/usePlayerLogicProgress.ts +135 -0
  10. package/src/components/composable/player/usePlayerStitching.ts +213 -0
  11. package/src/components/composable/player/usePlayerTranscript.ts +120 -0
  12. package/src/components/composable/player/usePlayerVast.ts +207 -0
  13. package/src/components/composable/podcasts/useCountdown.ts +53 -0
  14. package/src/components/composable/podcasts/usePodcastView.ts +85 -0
  15. package/src/components/composable/radio/usefetchRadioData.ts +75 -0
  16. package/src/components/composable/route/useAdvancedParamInit.ts +165 -0
  17. package/src/components/composable/route/useRouteUpdateParams.ts +48 -0
  18. package/src/components/composable/route/useRubriquesFilterComputed.ts +24 -0
  19. package/src/components/composable/route/useRubriquesFilterParam.ts +32 -0
  20. package/src/components/composable/route/useSeoTitleUrl.ts +30 -0
  21. package/src/components/composable/route/useSimplePageParam.ts +50 -0
  22. package/src/components/composable/useErrorHandler.ts +25 -0
  23. package/src/components/composable/useImageProxy.ts +28 -0
  24. package/src/components/composable/useInit.ts +38 -0
  25. package/src/components/composable/useMetaTitle.ts +19 -0
  26. package/src/components/composable/useMetaTitleWatch.ts +14 -0
  27. package/src/components/composable/useOrgaComputed.ts +23 -0
  28. package/src/components/composable/useOrganisationFilter.ts +65 -0
  29. package/src/components/composable/useResizePhone.ts +27 -0
  30. package/src/components/composable/useSelenium.ts +10 -0
  31. package/src/components/composable/useTagOf.ts +21 -0
  32. package/src/components/display/accessibility/AccessibilityModal.vue +136 -0
  33. package/src/components/display/aggregator/RssSection.vue +1 -4
  34. package/src/components/display/categories/CategoryChooser.vue +1 -1
  35. package/src/components/display/categories/CategoryFilter.vue +7 -3
  36. package/src/components/display/categories/CategoryList.vue +5 -2
  37. package/src/components/display/comments/CommentInput.vue +0 -3
  38. package/src/components/display/comments/CommentList.vue +6 -2
  39. package/src/components/display/comments/CommentPlayer.vue +5 -2
  40. package/src/components/display/comments/CommentSection.vue +0 -2
  41. package/src/components/display/comments/item/CommentBasicView.vue +4 -4
  42. package/src/components/display/comments/item/CommentItem.vue +0 -4
  43. package/src/components/display/comments/item/CommentMoreActions.vue +6 -2
  44. package/src/components/display/emission/EmissionInlineList.vue +6 -6
  45. package/src/components/display/emission/EmissionItem.vue +13 -6
  46. package/src/components/display/emission/EmissionList.vue +5 -2
  47. package/src/components/display/emission/EmissionPlayerItem.vue +8 -5
  48. package/src/components/display/emission/EmissionPresentationItem.vue +16 -7
  49. package/src/components/display/emission/EmissionPresentationList.vue +10 -7
  50. package/src/components/display/filter/AdvancedSearch.vue +9 -6
  51. package/src/components/display/filter/CategorySearchFilter.vue +0 -2
  52. package/src/components/display/filter/ProductorSearch.vue +8 -3
  53. package/src/components/display/filter/RubriqueFilter.vue +6 -2
  54. package/src/components/display/list/ListPaginate.vue +9 -6
  55. package/src/components/display/list/SwiperList.vue +6 -5
  56. package/src/components/display/live/CountDown.vue +7 -15
  57. package/src/components/display/live/CountdownOctopus.vue +10 -30
  58. package/src/components/display/live/LiveItem.vue +0 -2
  59. package/src/components/display/live/LiveList.vue +9 -4
  60. package/src/components/display/live/RadioCurrently.vue +9 -5
  61. package/src/components/display/live/RadioImage.vue +6 -4
  62. package/src/components/display/live/RadioItem.vue +1 -2
  63. package/src/components/display/live/RadioList.vue +5 -3
  64. package/src/components/display/live/RadioPlanning.vue +10 -7
  65. package/src/components/display/organisation/OrganisationChooser.vue +8 -4
  66. package/src/components/display/participant/ParticipantInlineList.vue +5 -5
  67. package/src/components/display/participant/ParticipantItem.vue +13 -5
  68. package/src/components/display/participant/ParticipantList.vue +6 -3
  69. package/src/components/display/playlist/PlaylistItem.vue +12 -5
  70. package/src/components/display/playlist/PlaylistList.vue +6 -3
  71. package/src/components/display/playlist/PodcastList.vue +8 -4
  72. package/src/components/display/podcastmaker/PodcastmakerHeader.vue +6 -3
  73. package/src/components/display/podcasts/DownloadPodcastButton.vue +2 -4
  74. package/src/components/display/podcasts/PodcastImage.vue +6 -3
  75. package/src/components/display/podcasts/PodcastInlineListTemplate.vue +7 -4
  76. package/src/components/display/podcasts/PodcastItem.vue +1 -1
  77. package/src/components/display/podcasts/PodcastItemInfo.vue +6 -3
  78. package/src/components/display/podcasts/PodcastList.vue +6 -3
  79. package/src/components/display/podcasts/PodcastModuleBox.vue +22 -9
  80. package/src/components/display/podcasts/PodcastPlayBar.vue +1 -3
  81. package/src/components/display/podcasts/PodcastPlayButton.vue +1 -3
  82. package/src/components/display/podcasts/PodcastRawTranscript.vue +79 -10
  83. package/src/components/display/podcasts/PodcastRubriqueList.vue +4 -3
  84. package/src/components/display/podcasts/TagList.vue +5 -2
  85. package/src/components/display/podcasts/VideoModuleBox.vue +6 -3
  86. package/src/components/display/rubriques/RubriqueChooser.vue +0 -2
  87. package/src/components/display/rubriques/RubriqueList.vue +7 -5
  88. package/src/components/display/sharing/ShareButtons.vue +4 -2
  89. package/src/components/display/sharing/ShareDistribution.vue +4 -2
  90. package/src/components/form/ClassicEmojiPicker.vue +5 -3
  91. package/src/components/misc/ClassicLazy.vue +2 -2
  92. package/src/components/misc/FooterGarSection.vue +2 -3
  93. package/src/components/misc/FooterSection.vue +9 -5
  94. package/src/components/misc/MobileMenu.vue +5 -3
  95. package/src/components/misc/TopBar.vue +8 -6
  96. package/src/components/misc/TopBarMainContent.vue +8 -4
  97. package/src/components/misc/modal/ClassicModalInBody.vue +2 -3
  98. package/src/components/misc/modal/ClipboardModal.vue +4 -3
  99. package/src/components/misc/modal/NewsletterModal.vue +4 -3
  100. package/src/components/misc/modal/ShareModalPlayer.vue +4 -2
  101. package/src/components/misc/player/PlayerCompact.vue +30 -41
  102. package/src/components/misc/player/PlayerComponent.vue +69 -84
  103. package/src/components/misc/player/PlayerLarge.vue +43 -58
  104. package/src/components/misc/player/elements/PlayerImage.vue +6 -3
  105. package/src/components/misc/player/elements/PlayerTitle.vue +6 -2
  106. package/src/components/misc/player/radio/RadioHistory.vue +2 -4
  107. package/src/components/misc/player/video/PlayerVideoHls.vue +6 -7
  108. package/src/components/pages/EmissionPage.vue +19 -7
  109. package/src/components/pages/EmissionsPage.vue +31 -23
  110. package/src/components/pages/HomePage.vue +5 -2
  111. package/src/components/pages/PageLogout.vue +0 -2
  112. package/src/components/pages/PageNotFound.vue +11 -15
  113. package/src/components/pages/ParticipantPage.vue +18 -7
  114. package/src/components/pages/ParticipantsPage.vue +16 -21
  115. package/src/components/pages/PlaylistPage.vue +18 -7
  116. package/src/components/pages/PlaylistsPage.vue +20 -29
  117. package/src/components/pages/PodcastPage.vue +12 -6
  118. package/src/components/pages/PodcastsPage.vue +46 -48
  119. package/src/components/pages/RadioPage.vue +9 -6
  120. package/src/components/pages/RubriquePage.vue +41 -52
  121. package/src/components/pages/VideoPage.vue +152 -166
  122. package/src/helper/cookiesHelper.ts +20 -0
  123. package/src/helper/displayHelper.ts +15 -0
  124. package/src/helper/downloadHelper.ts +30 -0
  125. package/src/helper/{fetch.ts → fetchHelper.ts} +0 -1
  126. package/src/helper/loadScript.ts +22 -0
  127. package/src/helper/radio/radioHelper.ts +15 -0
  128. package/src/helper/{string.ts → stringHelper.ts} +5 -0
  129. package/src/locale/de.ts +4 -0
  130. package/src/locale/en.ts +4 -0
  131. package/src/locale/es.ts +4 -0
  132. package/src/locale/fr.ts +4 -0
  133. package/src/locale/it.ts +4 -0
  134. package/src/locale/sl.ts +4 -0
  135. package/src/stores/AuthStore.ts +1 -2
  136. package/src/stores/CommentStore.ts +8 -8
  137. package/src/stores/PlayerStore.ts +1 -1
  138. package/src/style/general.scss +15 -1
  139. package/src/components/mixins/cookies.ts +0 -22
  140. package/src/components/mixins/displayMethods.ts +0 -17
  141. package/src/components/mixins/download.ts +0 -33
  142. package/src/components/mixins/fetchParameters.ts +0 -16
  143. package/src/components/mixins/handle403.ts +0 -22
  144. package/src/components/mixins/imageProxy.ts +0 -28
  145. package/src/components/mixins/init.ts +0 -34
  146. package/src/components/mixins/loadScript.ts +0 -25
  147. package/src/components/mixins/metaTitle.ts +0 -15
  148. package/src/components/mixins/metaTitleWatch.ts +0 -26
  149. package/src/components/mixins/orgaComputed.ts +0 -23
  150. package/src/components/mixins/organisationFilter.ts +0 -56
  151. package/src/components/mixins/player/playerDisplayTime.ts +0 -35
  152. package/src/components/mixins/player/playerLive.ts +0 -144
  153. package/src/components/mixins/player/playerLogic.ts +0 -275
  154. package/src/components/mixins/player/playerLogicProgress.ts +0 -135
  155. package/src/components/mixins/player/playerStitching.ts +0 -202
  156. package/src/components/mixins/player/playerTranscript.ts +0 -113
  157. package/src/components/mixins/player/playerVast.ts +0 -198
  158. package/src/components/mixins/podcast/countdown.ts +0 -45
  159. package/src/components/mixins/podcast/podcastView.ts +0 -63
  160. package/src/components/mixins/radio/fetchRadioData.ts +0 -77
  161. package/src/components/mixins/resizePhone.ts +0 -26
  162. package/src/components/mixins/routeParam/advancedParamInit.ts +0 -202
  163. package/src/components/mixins/routeParam/paginateParamInit.ts +0 -43
  164. package/src/components/mixins/routeParam/routeParams.ts +0 -33
  165. package/src/components/mixins/routeParam/rubriquesFilterComputed.ts +0 -22
  166. package/src/components/mixins/routeParam/rubriquesFilterParam.ts +0 -29
  167. package/src/components/mixins/selenium.ts +0 -7
  168. package/src/components/mixins/seoTitleUrl.ts +0 -26
  169. package/src/components/mixins/tagOfMixins.ts +0 -19
  170. package/src/helper/uuidGenerator.ts +0 -7
  171. /package/src/{helper → components/composable}/useEventListener.ts +0 -0
  172. /package/src/{components/mixins/debounce.ts → helper/debounceHelper.ts} +0 -0
  173. /package/src/helper/{dom.ts → domHelper.ts} +0 -0
  174. /package/src/helper/{duration.ts → durationHelper.ts} +0 -0
@@ -1,113 +0,0 @@
1
- import classicApi from "../../../api/classicApi";
2
- import { defineComponent } from "vue";
3
- import { usePlayerStore } from "../../../stores/PlayerStore";
4
- import { mapState, mapActions } from "pinia";
5
- import { AdserverOtherEmission } from "@/stores/class/adserver/adserverOtherEmission";
6
- import { useVastStore } from "../../../stores/VastStore";
7
- export const playerTranscript = defineComponent({
8
- computed: {
9
- ...mapState(usePlayerStore, ["playerTranscript", "playerPodcast", "playerDelayStitching"]),
10
- ...mapState(useVastStore, ["useVastPlayerPodcast"]),
11
- },
12
- methods: {
13
- ...mapActions(usePlayerStore, ["playerUpdateTranscript", "playerUpdateChaptering", "playerUpdateDelayStitching"]),
14
- async checkDelaytWithStitching(){
15
- this.playerUpdateDelayStitching(0);
16
- if(this.useVastPlayerPodcast){return;}
17
- const audioPlayer = document.querySelector("#audio-player") as HTMLAudioElement;
18
- if (!this.playerTranscript || !audioPlayer || !this.playerPodcast ||
19
- audioPlayer.duration <= this.playerPodcast.duration / 1000 + 5)
20
- {
21
- return;
22
- }
23
- const adserverConfig = await classicApi.fetchData<AdserverOtherEmission>({
24
- api:0,
25
- path:`ad/test/podcast/${this.playerPodcast.podcastId}`,
26
- isNotAuth:true
27
- });
28
- const doubletsLength = adserverConfig.config.doublets.length;
29
- if(1=== doubletsLength && "pre" === adserverConfig.config.doublets[0].timing.insertion){
30
- this.playerUpdateDelayStitching( audioPlayer.duration - (this.playerPodcast.duration / 1000));
31
- }else if(0===doubletsLength || 1=== doubletsLength && "post" === adserverConfig.config.doublets[0].timing.insertion){
32
- return;
33
- }else{
34
- this.playerUpdateChaptering();
35
- this.playerUpdateTranscript();
36
- }
37
- },
38
- async getTranscription(): Promise<void> {
39
- if (!this.playerPodcast) {
40
- this.playerUpdateTranscript();
41
- return;
42
- }
43
- const result = await classicApi.fetchData<string>({
44
- api:11,
45
- path:`response/${this.playerPodcast.podcastId}`,
46
- });
47
-
48
- const arrayTranscript = this.parseSrt(result);
49
- const actualText =
50
- arrayTranscript?.[0]?.startTime === 0 ? arrayTranscript[0].text : "";
51
- if(!arrayTranscript){
52
- return;
53
- }
54
- this.playerUpdateTranscript({
55
- actual: 0,
56
- actualText: actualText,
57
- value: arrayTranscript
58
- });
59
- },
60
- parseSrt(transcript: string) {
61
- const result = [];
62
- if (typeof transcript != "string") {
63
- return;
64
- }
65
- if (transcript == null) {
66
- return;
67
- }
68
- const pattern =
69
- /(\d+)\n([\d:,]+)\s+-{2}>\s+([\d:,]+)\n([\s\S]*?(?=\n{2}|$))/gm;
70
- transcript = transcript.replace(/\r\n|\r|\n|\t/g, "\n");
71
- let matches;
72
- while ((matches = pattern.exec(transcript)) != null) {
73
- result.push({
74
- startTime: this.srtTimeToSeconds(matches[2]),
75
- endTime: this.srtTimeToSeconds(matches[3]),
76
- text: matches[4],
77
- });
78
- }
79
- return result;
80
- },
81
- srtTimeToSeconds(time: string): number {
82
- const a = time.split(":");
83
- return +a[0] * 60 * 60 + +a[1] * 60 + +parseFloat(a[2]);
84
- },
85
- onTimeUpdateTranscript(currentTime: number) {
86
- if(!this.playerTranscript?.value.length){
87
- return;
88
- }
89
- const startTime = (this.playerTranscript.value[this.playerTranscript.actual]?.startTime ?? 0) + this.playerDelayStitching;
90
- if (startTime <= currentTime) {
91
- this.playerTranscript.actualText = this.playerTranscript.value[this.playerTranscript?.actual]?.text ??"";
92
- }
93
- if (
94
- (this.playerTranscript.value[this.playerTranscript.actual]?.endTime ??Infinity) + this.playerDelayStitching< currentTime
95
- ) {
96
- this.playerTranscript.actual += 1;
97
- this.playerTranscript.actualText =
98
- this.playerTranscript?.value[this.playerTranscript.actual]?.text ??
99
- "";
100
- }
101
- },
102
-
103
- onSeekedTranscript(currentTime: number) {
104
- if (this.playerTranscript) {
105
- let newActual = 0;
106
- while (currentTime >(this.playerTranscript.value[newActual]?.endTime ?? Infinity) + this.playerDelayStitching) {
107
- newActual += 1;
108
- }
109
- this.playerTranscript.actual = newActual;
110
- }
111
- },
112
- },
113
- });
@@ -1,198 +0,0 @@
1
- import { defineComponent } from "vue";
2
- import { loadScript } from "../loadScript";
3
- import { usePlayerStore } from "../../../stores/PlayerStore";
4
- import { useVastStore } from "../../../stores/VastStore";
5
- import { mapState, mapActions } from "pinia";
6
-
7
- let adsLoader: any;
8
- let adsManager:any;
9
- let adDisplayContainer:any;
10
- let adsRequest: any;
11
-
12
- export const playerVast = defineComponent({
13
- mixins:[loadScript],
14
- data() {
15
- return {
16
- imaLoaded: false as boolean,
17
- isContentFinished: false as boolean,
18
- audioContainer: null as HTMLAudioElement|null,
19
- isAdRequested: false as boolean,
20
- statusPlayerWhenLoaded: "" as string
21
- };
22
- },
23
- computed: {
24
- ...mapState(usePlayerStore, ["playerPodcast", "playerStatus","playerCurrentChange","playerVideo"]),
25
- ...mapState(useVastStore, ["isAdPlaying", "currentAd", "isAdPaused", "isAdSkipped", "vastUrl"]),
26
- },
27
- watch:{
28
- isAdPaused(){
29
- this.onAdChangePlayingStatus();
30
- },
31
- isAdSkipped(){
32
- this.onAdSkipped();
33
- }
34
- },
35
- methods: {
36
- ...mapActions(useVastStore, ["updateIsAdPlaying","updateIsAdPaused", "updateSkippableData", "updateCurrentAd", "updateProgressionData", "restartVastData"]),
37
- ...mapActions(usePlayerStore, ["playerChangeStatus"]),
38
- prepareIMA(){
39
- if(!this.imaLoaded){
40
- this.imaLoaded = true;
41
- this.loadIMA();
42
- }else{
43
- this.initializeIMA();
44
- }
45
- },
46
- loadIMA(){
47
- this.loadScript('//imasdk.googleapis.com/js/sdkloader/ima3.js', true, (isIMALoaded:boolean) => {
48
- if(isIMALoaded) {
49
- this.initializeIMA();
50
- }
51
- });
52
- },
53
- initializeIMA(): void {
54
- console.log("Initialize IMA");
55
- this.initializeDisplayContainer();
56
- if(!adDisplayContainer || !adsLoader){
57
- return;
58
- }
59
- },
60
- onRequestAd(vastUrl: string){
61
- this.isAdRequested = true;
62
- console.log("Request ad "+vastUrl);
63
- this.initializeAdsRequest(vastUrl);
64
- adsLoader.requestAds(adsRequest);
65
- },
66
- initializeDisplayContainer():void{
67
- if(adDisplayContainer){return};
68
- this.audioContainer = (document.getElementById('audio-player') as HTMLAudioElement);
69
- if(null===this.audioContainer){return;}
70
- adDisplayContainer = new google.ima.AdDisplayContainer(document.getElementById('ad-container'), this.audioContainer);
71
- adDisplayContainer.initialize();
72
- this.initializeAdsLoader();
73
- },
74
- initializeAdsLoader():void{
75
- adsLoader = new google.ima.AdsLoader(adDisplayContainer);
76
- adsManager = null;
77
- adsLoader.addEventListener(
78
- google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,
79
- this.onAdsManagerLoaded,
80
- false
81
- );
82
- adsLoader.addEventListener(
83
- google.ima.AdErrorEvent.Type.AD_ERROR,
84
- this.onAdError,
85
- false
86
- );
87
- },
88
- initializeAdsRequest(vastUrl: string):void{
89
- adsRequest = new google.ima.AdsRequest();
90
- adsRequest.setAdWillAutoPlay(true);
91
- adsRequest.adTagUrl = vastUrl;
92
- },
93
- onAdsManagerLoaded(adsManagerLoadedEvent: any) {
94
- const adsRenderingSettings = new google.ima.AdsRenderingSettings();
95
- adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete = true;
96
- adsManager = adsManagerLoadedEvent.getAdsManager(this.audioContainer, adsRenderingSettings);
97
- this.startAdManager();
98
- },
99
- startAdManager(){
100
- console.log("Start manager");
101
- this.initAdManagerEvents();
102
- try {
103
- adsManager.init(0, 0, google.ima.ViewMode.NORMAL);
104
- adsManager.start();
105
- } catch (adError) {
106
- console.log(adError);
107
- this.playerChangeStatus(false);
108
- this.destroyAdManager();
109
- }
110
- },
111
- initAdManagerEvents(){
112
- adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError);
113
- adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED, this.onContentPauseRequested);
114
- adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED, this.onContentResumeRequested);
115
- const events = [
116
- google.ima.AdEvent.Type.ALL_ADS_COMPLETED, google.ima.AdEvent.Type.AD_PROGRESS,
117
- google.ima.AdEvent.Type.COMPLETE, google.ima.AdEvent.Type.LOADED,
118
- google.ima.AdEvent.Type.PAUSED, google.ima.AdEvent.Type.STARTED,
119
- ];
120
- for (const index in events) {
121
- adsManager.addEventListener(events[index], this.onAdEvent);
122
- }
123
- },
124
- onAdError(adErrorEvent: any) {
125
- console.log(adErrorEvent.getError());
126
- this.destroyAdManager();
127
- },
128
- destroyAdManager(){
129
- if(!adsManager){return;}
130
- console.log("Destroy manager");
131
- adsManager?.destroy();
132
- adsManager = null;
133
- this.restartVastData();
134
- this.isContentFinished=false;
135
- this.isAdRequested = false;
136
- },
137
- onAdEvent(adEvent: any) {
138
- const ad = adEvent.getAd();
139
- if(ad){
140
- this.updateCurrentAd(ad);
141
- }
142
- switch (adEvent.type) {
143
- case google.ima.AdEvent.Type.LOADED:
144
- this.statusPlayerWhenLoaded= this.playerStatus;
145
- if (!ad.isLinear()) {
146
- this.playerChangeStatus(false);
147
- this.isAdRequested = false;
148
- }
149
- break;
150
- case google.ima.AdEvent.Type.STARTED:
151
- console.log("Launched status : "+this.statusPlayerWhenLoaded);
152
- if("PLAYING"!==this.statusPlayerWhenLoaded){
153
- this.updateIsAdPaused(true);
154
- adsManager.pause();
155
- }
156
- break;
157
- case google.ima.AdEvent.Type.AD_PROGRESS:{
158
- this.isAdRequested = false;
159
- const adProgressData = adEvent.getAdData();
160
- this.updateProgressionData(adProgressData.duration,adProgressData.currentTime);
161
- this.updateSkippableData(
162
- this.currentAd.getSkipTimeOffset()!== -1,
163
- adsManager.getAdSkippableState(),
164
- Math.ceil(this.currentAd.getSkipTimeOffset() - adProgressData.currentTime));
165
- break;
166
- }
167
- }
168
- },
169
- onContentPauseRequested() {
170
- this.updateIsAdPlaying(true);
171
- this.playerChangeStatus(true);
172
- },
173
- onContentResumeRequested() {
174
- this.updateIsAdPlaying(false);
175
- if (!this.isContentFinished) {
176
- this.playerChangeStatus(false);
177
- }
178
- },
179
- contentEndedAdsLoader():void{
180
- if (this.isAdPlaying) return;
181
- this.isContentFinished = true;
182
- adsLoader?.contentComplete();
183
- },
184
- onAdChangePlayingStatus(){
185
- if(!adsManager){return;}
186
- if(this.isAdPaused){
187
- adsManager.pause();
188
- }else{
189
- adsManager.resume();
190
- }
191
- },
192
- onAdSkipped(){
193
- if(this.isAdSkipped){
194
- adsManager.skip();
195
- }
196
- }
197
- },
198
- });
@@ -1,45 +0,0 @@
1
- import { defineComponent } from 'vue';
2
- export default defineComponent({
3
- props: {
4
- timeRemaining: { default: undefined, type: Number },
5
- },
6
- data() {
7
- return {
8
- seconds: 0 as number,
9
- countdownTimer: undefined as ReturnType<typeof setTimeout> | undefined,
10
- days: 0 as number,
11
- hours: 0 as number,
12
- minutes: 0 as number,
13
- remainingSeconds: 0 as number,
14
- };
15
- },
16
- mounted() {
17
- if (!this.timeRemaining || this.timeRemaining <= 0) return;
18
- this.seconds = this.timeRemaining;
19
- this.countdownTimer = setInterval(() => {
20
- this.timer();
21
- }, 1000);
22
- },
23
- unmounted() {
24
- clearInterval(this.countdownTimer as unknown as number);
25
- },
26
- methods: {
27
- timer(): void {
28
- this.days = Math.floor(this.seconds / 24 / 60 / 60);
29
- const hoursLeft = Math.floor(this.seconds - this.days * 86400);
30
- this.hours = Math.floor(hoursLeft / 3600);
31
- const minutesLeft = Math.floor(hoursLeft - this.hours * 3600);
32
- this.minutes = Math.floor(minutesLeft / 60);
33
- this.remainingSeconds = this.seconds % 60;
34
- if (0 === this.seconds) {
35
- clearInterval(this.countdownTimer as unknown as number);
36
- this.countdownTimer = undefined;
37
- } else {
38
- this.seconds--;
39
- }
40
- },
41
- pad(n: number): string {
42
- return/* n < 10 ? "0" + n : */ n.toString();
43
- },
44
- },
45
- });
@@ -1,63 +0,0 @@
1
- import dayjs from "dayjs";
2
- import duration from "dayjs/plugin/duration";
3
- dayjs.extend(duration);
4
-
5
- // @ts-expect-error Bibliothèque non typée
6
- import humanizeDuration from "humanize-duration";
7
- import { defineComponent } from 'vue';
8
- export default defineComponent({
9
- computed:{
10
- isCounter(): boolean {
11
- return (
12
- this.isLiveReadyToRecord &&
13
- undefined !== this.podcastConference &&
14
- ("PLANNED" === this.podcastConference.status ||
15
- "PENDING" === this.podcastConference.status)
16
- );
17
- },
18
- timeRemaining(): number {
19
- return !this.podcast
20
- ? 0
21
- : dayjs(this.podcast.pubDate).diff(dayjs(), "seconds");
22
- },
23
- isPlannedInProcessor(): boolean {
24
- return "PLANNED" === this.podcast?.processingStatus;
25
- },
26
- isLiveReadyToRecord(): boolean {
27
- return (
28
- undefined !== this.podcast &&
29
- undefined !== this.podcast.conferenceId &&
30
- 0 !== this.podcast.conferenceId &&
31
- "READY_TO_RECORD" === this.podcast.processingStatus
32
- );
33
- },
34
- date(): string {
35
- if (!this.podcast || 1970 === dayjs(this.podcast.pubDate).year()) {
36
- return "";
37
- }
38
- if (this.isLiveReadyToRecord) {
39
- return dayjs(this.podcast.pubDate).format("D MMMM YYYY - HH:mm");
40
- }
41
- return dayjs(this.podcast.pubDate).format("D MMMM YYYY");
42
- },
43
- duration(): string {
44
- if (!this.podcast || this.podcast.duration <= 1) return "";
45
- if (this.podcast.duration > 600000) {
46
- return humanizeDuration(this.podcast.duration, {
47
- language: this.$i18n.locale,
48
- largest: 1,
49
- round: true,
50
- });
51
- }
52
- return humanizeDuration(this.podcast.duration, {
53
- language: this.$i18n.locale,
54
- largest: 2,
55
- round: true,
56
- });
57
- },
58
- durationIso(): string {
59
- if (!this.podcast || this.podcast.duration <= 1) return "";
60
- return dayjs.duration({ milliseconds: this.podcast.duration }).toISOString();
61
- },
62
- }
63
- });
@@ -1,77 +0,0 @@
1
- import { defineComponent } from "vue";
2
- import { MediaRadio, MetadataRadio, NextAdvertising } from "@/stores/class/general/player";
3
- import classicApi from "../../../api/classicApi";
4
- import dayjs from "dayjs";
5
- import { Podcast } from "@/stores/class/general/podcast";
6
- export const fetchRadioData = defineComponent({
7
- data() {
8
- return {
9
- radioInterval: undefined as ReturnType<typeof setTimeout> | undefined,
10
- };
11
- },
12
- unmounted() {
13
- clearInterval(this.radioInterval as unknown as number);
14
- },
15
- methods: {
16
- async fetchRadioMetadata(
17
- canalId: number,
18
- previousTitle: string,
19
- callbackMetadata: (
20
- metadata: MediaRadio,
21
- podcast: Podcast | undefined,
22
- history: Array<MediaRadio>
23
- ) => void,
24
- callbackAdvertising?: (
25
- nextAdvertising: NextAdvertising
26
- ) => void,
27
- ): Promise<void> {
28
- const metadata = await classicApi.fetchData<MetadataRadio>({
29
- api: 14,
30
- path: "player/playing/" + canalId,
31
- });
32
- if(callbackAdvertising){
33
- callbackAdvertising(metadata.nextAdvertising);
34
- }
35
- const arrayMetadata = metadata.previously;
36
- arrayMetadata.unshift(metadata.currently);
37
- for (let index = 0, len = arrayMetadata.length; index < len; index++) {
38
- if (
39
- dayjs().valueOf() - 18000 >
40
- dayjs(arrayMetadata[index].startDate).valueOf()
41
- ) {
42
- await this.useCallbackIfNewMetadata(previousTitle, arrayMetadata, index, len,callbackMetadata);
43
- return;
44
- }
45
- }
46
- },
47
- async useCallbackIfNewMetadata(previousTitle: string, arrayMetadata: Array<MediaRadio>, index:number, len: number, callbackMetadata: (
48
- metadata: MediaRadio,
49
- podcast: Podcast | undefined,
50
- history: Array<MediaRadio>
51
- ) => void){
52
- if (previousTitle !== arrayMetadata[index].title) {
53
- const historyIndex = index + 1 < len ? index + 1 : index;
54
- const history = arrayMetadata.slice(historyIndex, len);
55
- if (arrayMetadata[index].podcastId) {
56
- const data: Podcast = await classicApi.fetchData<Podcast>({
57
- api: 0,
58
- path: "podcast/" + arrayMetadata[index].podcastId,
59
- });
60
- callbackMetadata(arrayMetadata[index], data, history);
61
- } else {
62
- callbackMetadata(arrayMetadata[index], undefined, history);
63
- }
64
- }
65
- },
66
- displayTitle(metadata: MediaRadio): string {
67
- let title = "";
68
- if (metadata.title) {
69
- title += metadata.title;
70
- }
71
- if (metadata.artist) {
72
- title += " - " + metadata.artist;
73
- }
74
- return title;
75
- },
76
- },
77
- });
@@ -1,26 +0,0 @@
1
-
2
- import debounce from './debounce';
3
- import { defineComponent } from 'vue';
4
- export default defineComponent({
5
- data() {
6
- return {
7
- isPhone: false as boolean,
8
- windowWidth: 0 as number,
9
- debounceResizeEvent: undefined as undefined|((...args: any[]) => void)
10
- };
11
- },
12
- created() {
13
- this.debounceResizeEvent = debounce(this.handleResize, 500);
14
- window.addEventListener('resize', this.debounceResizeEvent);
15
- this.handleResize();
16
- },
17
- unmounted() {
18
- window.removeEventListener('resize', this.debounceResizeEvent);
19
- },
20
- methods: {
21
- handleResize(): void {
22
- this.windowWidth= window.innerWidth;
23
- this.isPhone =this.windowWidth < 960;
24
- },
25
- },
26
- });