@saooti/octopus-sdk 31.0.18 → 31.0.21

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.
@@ -1,176 +0,0 @@
1
- <template>
2
- <div class="text-light player-grow-content">
3
- <div class="d-flex mb-1">
4
- <div
5
- v-if="playerError"
6
- class="text-warning mx-2"
7
- >
8
- {{ $t('Podcast play error') + ' - ' }}
9
- </div>
10
- <div class="flex-grow-1 text-truncate">
11
- {{ podcastTitle }}
12
- </div>
13
- <div
14
- v-if="!playerError && !isBarTop"
15
- class="hide-phone"
16
- >
17
- {{ playedTime }} / {{ totalTime }}
18
- </div>
19
- </div>
20
- <div
21
- v-if="!playerError"
22
- v-show="!isBarTop"
23
- class="progress c-hand"
24
- @mouseup="seekTo"
25
- >
26
- <div
27
- class="progress-bar bg-light"
28
- role="progressbar"
29
- aria-valuenow="0"
30
- aria-valuemin="0"
31
- aria-valuemax="100"
32
- :style="'width: ' + percentLiveProgress + '%'"
33
- />
34
- <div
35
- class="progress-bar primary-bg"
36
- role="progressbar"
37
- aria-valuenow="0"
38
- aria-valuemin="0"
39
- aria-valuemax="100"
40
- :style="'width: ' + percentProgress + '%'"
41
- />
42
- <div
43
- v-if="displayAlertBar"
44
- class="progress-bar progress-bar-duration bg-danger"
45
- :style="'left: ' + durationLivePosition + '%'"
46
- />
47
- </div>
48
- <CommentPlayer
49
- v-if="showTimeline"
50
- :total-time="totalSecondes"
51
- :comments="comments"
52
- />
53
- </div>
54
- </template>
55
-
56
- <script lang="ts">
57
- import { state } from '../../store/paramStore';
58
- import DurationHelper from '../../helper/duration';
59
- import { CommentPodcast } from '@/store/class/general/comment';
60
- import { defineComponent, defineAsyncComponent } from 'vue';
61
- const CommentPlayer = defineAsyncComponent(() => import('../display/comments/CommentPlayer.vue'));
62
- export default defineComponent({
63
- name: 'PlayerProgressBar',
64
-
65
- components: {
66
- CommentPlayer,
67
- },
68
- props: {
69
- hlsReady: { default: false, type: Boolean},
70
- showTimeline: { default: false, type: Boolean},
71
- comments: { default: ()=>[], type: Array as ()=>Array<CommentPodcast>},
72
- displayAlertBar: { default: false, type: Boolean},
73
- percentLiveProgress: { default: 0, type: Number},
74
- durationLivePosition: { default: 0, type: Number},
75
- playerError: { default: false, type: Boolean},
76
- listenTime: { default: 0, type: Number},
77
- notListenTime: { default: 0, type: Number},
78
- },
79
- emits: ['update:notListenTime'],
80
-
81
- computed: {
82
- isEmissionName(): boolean {
83
- return (state.player.emissionName as boolean);
84
- },
85
- isBarTop(): boolean {
86
- return (state.player.barTop as boolean);
87
- },
88
- playedTime(): string{
89
- if (this.$store.state.player.elapsed && this.$store.state.player.elapsed > 0 && this.$store.state.player.total && this.$store.state.player.total > 0) {
90
- return DurationHelper.formatDuration(
91
- Math.round(this.$store.state.player.elapsed * this.$store.state.player.total)
92
- );
93
- }
94
- return '--:--';
95
- },
96
- percentProgress(): number{
97
- if(!this.$store.state.player.elapsed){return 0;}
98
- return this.$store.state.player.elapsed * 100;
99
- },
100
- totalTime(): string {
101
- if (this.$store.state.player.elapsed && this.$store.state.player.elapsed > 0 && this.$store.state.player.total && this.$store.state.player.total > 0)
102
- return DurationHelper.formatDuration(Math.round(this.$store.state.player.total));
103
- return '--:--';
104
- },
105
- totalSecondes(): number{
106
- return this.$store.state.player.total;
107
- },
108
- podcastTitle(): string {
109
- if (this.$store.state.player.podcast) {
110
- if (this.isEmissionName)
111
- return this.emissionName + ' - ' + this.$store.state.player.podcast.title;
112
- return this.$store.state.player.podcast.title;
113
- }
114
- if (this.$store.state.player.media) return this.$store.state.player.media.title;
115
- if (this.$store.state.player.live) {
116
- if (!this.hlsReady)
117
- return this.$store.state.player.live.title + ' (' + this.$t('Start in a while') + ')';
118
- return this.$store.state.player.live.title;
119
- }
120
- return '';
121
- },
122
- emissionName(): string {
123
- if (this.$store.state.player.podcast) return this.$store.state.player.podcast.emission.name;
124
- return '';
125
- },
126
- },
127
-
128
-
129
- methods: {
130
- seekTo(event: MouseEvent): void {
131
- const audioPlayer: HTMLAudioElement|null = document.querySelector('#audio-player');
132
- if(!audioPlayer ||null===event.currentTarget){return;}
133
- const rect = (event.currentTarget as Element).getBoundingClientRect();
134
- const barWidth = (event.currentTarget as Element).clientWidth;
135
- const x = event.clientX - rect.left;
136
- const percentPosition = x / barWidth;
137
- if (percentPosition * 100 >= this.percentLiveProgress) return;
138
- const seekTime = this.$store.state.player.total * percentPosition;
139
- if (this.$store.state.player.podcast || this.$store.state.player.live) {
140
- this.$emit('update:notListenTime',seekTime - this.listenTime);
141
- }
142
- audioPlayer.currentTime = seekTime;
143
- }
144
- },
145
- })
146
- </script>
147
-
148
- <style lang="scss">
149
- .octopus-app{
150
- .player-grow-content {
151
- display: flex;
152
- flex-direction: column;
153
- flex-grow: 1;
154
- flex-shrink: 1;
155
- overflow: hidden;
156
- font-size: 0.8rem;
157
- .progress {
158
- height: 4px;
159
- position: relative;
160
- @media (max-width: 960px) {
161
- height: 8px;
162
- }
163
- }
164
- .progress-bar-duration {
165
- width: 10px;
166
- }
167
- .progress-bar {
168
- height: 4px;
169
- position: absolute;
170
- @media (max-width: 960px) {
171
- height: 8px;
172
- }
173
- }
174
- }
175
- }
176
- </style>