@saooti/octopus-sdk 38.3.9 → 38.3.10

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.3.9",
3
+ "version": "38.3.10",
4
4
  "private": false,
5
5
  "description": "Javascript SDK for using octopus",
6
6
  "author": "Saooti",
@@ -1,4 +1,5 @@
1
1
  import { state } from "../../../stores/ParamSdkStore";
2
+ import dayjs from "dayjs";
2
3
  import { playerLogicProgress} from "./playerLogicProgress";
3
4
  import { usePlayerStore } from "@/stores/PlayerStore";
4
5
  import { useAuthStore } from "@/stores/AuthStore";
@@ -6,6 +7,7 @@ import { mapState, mapActions } from "pinia";
6
7
  /* eslint-disable */
7
8
  let Hls:any = null;
8
9
  /* eslint-enable */
10
+ const maxMinutesSessionId = 1;
9
11
  import { defineComponent } from "vue";
10
12
  export const playerLive = defineComponent({
11
13
  mixins: [playerLogicProgress],
@@ -31,7 +33,20 @@ export const playerLive = defineComponent({
31
33
  },
32
34
  playRadio() {
33
35
  if (!this.playerRadio) return;
34
- this.playHls(this.playerRadio.url);
36
+ this.handleSessionIdRadio();
37
+ this.playHls(this.playerRadio.url+"?origin=octopus&sessionId="+this.playerRadio.sessionId);
38
+ },
39
+ handleSessionIdRadio(){
40
+ if(!this.playerRadio) return;
41
+ if(this.playerRadio.sessionId && dayjs().diff(dayjs(this.playerRadio.dateSessionId), 'm')<maxMinutesSessionId){
42
+ return;
43
+ }
44
+ this.playerRadio.sessionId = this.uuidv4();
45
+ },
46
+ uuidv4() {
47
+ return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c =>
48
+ (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
49
+ );
35
50
  },
36
51
  playLive() {
37
52
  if (!this.playerLive) return;
@@ -9,6 +9,7 @@ import { useAuthStore } from "@/stores/AuthStore";
9
9
  import { useGeneralStore } from "@/stores/GeneralStore";
10
10
  import { usePlayerStore } from "@/stores/PlayerStore";
11
11
  import { mapState, mapActions } from "pinia";
12
+ import dayjs from "dayjs";
12
13
  export const playerLogic = defineComponent({
13
14
  mixins: [cookies, playerLive, playerComment, playerTranscript],
14
15
  data() {
@@ -110,6 +111,7 @@ export const playerLogic = defineComponent({
110
111
  return;
111
112
  }
112
113
  if ("PAUSED" === this.playerStatus && this.playerRadio) {
114
+ this.playerRadio.dateSessionId = dayjs().toISOString();
113
115
  this.hlsReady = false;
114
116
  this.reInitPlayer();
115
117
  this.endingLive();
@@ -8,6 +8,8 @@ export interface Radio {
8
8
  history: Array<MediaRadio>;
9
9
  isInit: boolean;
10
10
  podcast?: Podcast;
11
+ sessionId?: string;
12
+ dateSessionId?:string;
11
13
  }
12
14
  export interface MediaRadio {
13
15
  artist: string;