@saooti/octopus-sdk 38.0.18 → 38.0.20

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saooti/octopus-sdk",
3
- "version": "38.0.18",
3
+ "version": "38.0.20",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -6,14 +6,15 @@
6
6
  >
7
7
  <template #body>
8
8
  <div class="d-flex flex-column">
9
- <a
9
+ <button
10
10
  v-for="(chapter, index) in playerChapteringPercent"
11
11
  :key="chapter"
12
- class="c-hand text-truncate mb-1"
12
+ class="btn d-flex flex-nowrap align-items-center p-2 mt-1 c-hand text-truncate mb-1 border"
13
13
  @click="goToChapter(index)"
14
14
  >
15
- {{ chapter.startTime + " - " + chapter.title }}
16
- </a>
15
+ <div class="me-auto">{{ index + 1 + " - " + chapter.title }}</div>
16
+ <div>{{ chapter.startDisplay }}</div>
17
+ </button>
17
18
  </div>
18
19
  </template>
19
20
  <template #footer>
@@ -54,7 +55,10 @@ export default defineComponent({
54
55
  this.audioPlayer = document.querySelector("#audio-player");
55
56
  },
56
57
  methods: {
57
- ...mapActions(usePlayerStore, ["playerUpdateSeekTime"]),
58
+ ...mapActions(usePlayerStore, [
59
+ "playerUpdateSeekTime",
60
+ "playerUpdateElapsed",
61
+ ]),
58
62
  closePopup(): void {
59
63
  this.$emit("close");
60
64
  },
@@ -65,8 +69,9 @@ export default defineComponent({
65
69
  const seekTime =
66
70
  this.playerTotal *
67
71
  (this.playerChapteringPercent[index].startPercent / 100);
68
- if (this.playerPodcast || this.playerLive) {
69
- this.playerUpdateSeekTime(seekTime);
72
+ this.playerUpdateSeekTime(seekTime);
73
+ if (0 === seekTime) {
74
+ this.playerUpdateElapsed(0);
70
75
  }
71
76
  this.audioPlayer.currentTime = seekTime;
72
77
  },
@@ -4,7 +4,9 @@
4
4
  class="btn-transparent d-flex align-items-center text-truncate medium-text text-light"
5
5
  @click="showChaptering = !showChaptering"
6
6
  >
7
- <div class="text-truncate">{{ "• " + actualChapter.title }}</div>
7
+ <div class="text-truncate">
8
+ {{ actualIndex + 1 + " - " + actualChapter.title }}
9
+ </div>
8
10
  <span class="saooti-right small-text" />
9
11
  </button>
10
12
  <ChapteringModal v-if="showChaptering" @close="showChaptering = false" />
@@ -27,6 +29,7 @@ export default defineComponent({
27
29
  data() {
28
30
  return {
29
31
  actualChapter: undefined as ChapterPercent | undefined,
32
+ actualIndex: 0 as number,
30
33
  showChaptering: false as boolean,
31
34
  };
32
35
  },
@@ -57,6 +60,7 @@ export default defineComponent({
57
60
  this.isInChapter(progressPercent, this.playerChapteringPercent[i])
58
61
  ) {
59
62
  this.actualChapter = this.playerChapteringPercent[i];
63
+ this.actualIndex = i;
60
64
  return;
61
65
  }
62
66
  }
@@ -24,7 +24,7 @@
24
24
  {{ podcastTitle }}
25
25
  </div>
26
26
  </div>
27
- <PlayerChaptering class="w-100" />
27
+ <PlayerChaptering class="justify-content-center w-100" />
28
28
  <div class="player-grow-large-content">
29
29
  <PlayerProgressBar
30
30
  v-if="!radioUrl"
@@ -41,7 +41,7 @@ export const playerLogicProgress = defineComponent({
41
41
  );
42
42
  },
43
43
  playerSeekTime() {
44
- if (!this.playerSeekTime) {
44
+ if (undefined===this.playerSeekTime) {
45
45
  return;
46
46
  }
47
47
  if (this.playerPodcast || this.playerLive) {
@@ -13,6 +13,6 @@ export default {
13
13
  const hours = Math.floor(totalSeconds / 3600);
14
14
  const minutes = Math.floor((totalSeconds - hours * 3600) / 60);
15
15
  const seconds = totalSeconds - hours * 3600 - minutes * 60;
16
- return (hours > 0? this.formatToString(hours)+separator:"") + this.formatToString(minutes) +separator+ this.formatToString(seconds) + (isLast?separator:separator );
16
+ return (hours > 0? this.formatToString(hours)+separator:"") + this.formatToString(minutes) +separator+ this.formatToString(seconds) + (isLast?separator:'' );
17
17
  },
18
18
  };
@@ -46,14 +46,14 @@ export const usePlayerStore = defineStore("PlayerStore", {
46
46
  if(!this.playerChaptering || 0===this.playerTotal){
47
47
  return;
48
48
  }
49
- const chapteringKeys = Object.keys(this.playerChaptering);
50
49
  let chapteringPercent: ChapteringPercent = [];
51
- for (let i = 0, len = chapteringKeys.length; i < len; i++) {
50
+ for (let i = 0, len = this.playerChaptering.chapters.length; i < len; i++) {
52
51
  chapteringPercent.push({
53
- startTime : chapteringKeys[i],
54
- startPercent: (DurationHelper.convertTimestamptoSeconds(chapteringKeys[i]) * 100 ) / (Math.round(this.playerTotal)),
52
+ startTime : this.playerChaptering.chapters[i].startTime,
53
+ startDisplay: DurationHelper.formatDuration(this.playerChaptering.chapters[i].startTime, ':', false),
54
+ startPercent: (this.playerChaptering.chapters[i].startTime * 100 ) / (Math.round(this.playerTotal)),
55
55
  endPercent:100,
56
- title: this.playerChaptering[chapteringKeys[i]]
56
+ title: this.playerChaptering.chapters[i].title
57
57
  });
58
58
  }
59
59
  for (let i = 0, len = chapteringPercent.length; i < len; i++) {
@@ -192,9 +192,11 @@ export const usePlayerStore = defineStore("PlayerStore", {
192
192
  this.playerRadio.podcast = podcast;
193
193
  },
194
194
 
195
- playerUpdateElapsed(elapsed: number, total: number) {
195
+ playerUpdateElapsed(elapsed: number, total?: number) {
196
196
  this.playerElapsed = elapsed;
197
- this.playerTotal = total;
197
+ if(total){
198
+ this.playerTotal = total;
199
+ }
198
200
  },
199
201
 
200
202
  playerUpdateTranscript(transcript?: Transcript) {
@@ -1,12 +1,23 @@
1
+ //https://github.com/Podcastindex-org/podcast-namespace/blob/main/chapters/jsonChapters.md
1
2
  export interface Chaptering {
2
- [startTime: string] : string;
3
+ version: string;
4
+ chapters: Array<Chapter>;
5
+ }
6
+
7
+ export interface Chapter{
8
+ startTime: number;
9
+ title: string;
10
+ img?: string;
11
+ url?:string
3
12
  }
4
13
 
5
14
  export interface ChapterPercent {
6
- startTime: string;
15
+ startTime: number;
16
+ startDisplay: string;
7
17
  startPercent: number;
8
18
  endPercent: number;
9
19
  title: string;
10
20
  }
11
21
 
22
+
12
23
  export type ChapteringPercent = Array<ChapterPercent>;