@94ai/nf-audio 3.3.63 → 3.3.64

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.
@@ -97,6 +97,10 @@ const _sfc_main = {
97
97
  betweenEnd: {
98
98
  type: Number,
99
99
  default: 0
100
+ },
101
+ highPrecision: {
102
+ type: Boolean,
103
+ default: false
100
104
  }
101
105
  },
102
106
  data() {
@@ -274,8 +278,14 @@ const _sfc_main = {
274
278
  } catch (e) {
275
279
  }
276
280
  },
281
+ isHighPrecision() {
282
+ if (this.highPrecision) {
283
+ return true;
284
+ }
285
+ return window.location.protocol === "https:" || window.location.hostname === "localhost";
286
+ },
277
287
  async startAudioCtx() {
278
- if (window.location.protocol == "https:" || window.location.hostname === "localhost") {
288
+ if (this.isHighPrecision()) {
279
289
  if (!this.audioCtx) {
280
290
  this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
281
291
  this.audioSource = this.audioCtx.createMediaElementSource(this.audio);
@@ -338,7 +348,7 @@ const _sfc_main = {
338
348
  this.$refs.progressCurrent.style.width = MoveX + "px";
339
349
  this.$refs.progressBar.style.left = MoveX - this.$refs.progressBar.clientWidth / 2 + "px";
340
350
  this.paused = false;
341
- if (window.location.protocol == "http:" && window.location.hostname !== "localhost" && this.betweenPlaying) {
351
+ if (!this.isHighPrecision() && this.betweenPlaying) {
342
352
  if (this.betweenEnd) {
343
353
  if (this.debuglog) {
344
354
  console.log(this.audio.currentTime);
@@ -95,6 +95,10 @@ const _sfc_main = {
95
95
  betweenEnd: {
96
96
  type: Number,
97
97
  default: 0
98
+ },
99
+ highPrecision: {
100
+ type: Boolean,
101
+ default: false
98
102
  }
99
103
  },
100
104
  data() {
@@ -272,8 +276,14 @@ const _sfc_main = {
272
276
  } catch (e) {
273
277
  }
274
278
  },
279
+ isHighPrecision() {
280
+ if (this.highPrecision) {
281
+ return true;
282
+ }
283
+ return window.location.protocol === "https:" || window.location.hostname === "localhost";
284
+ },
275
285
  async startAudioCtx() {
276
- if (window.location.protocol == "https:" || window.location.hostname === "localhost") {
286
+ if (this.isHighPrecision()) {
277
287
  if (!this.audioCtx) {
278
288
  this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
279
289
  this.audioSource = this.audioCtx.createMediaElementSource(this.audio);
@@ -336,7 +346,7 @@ const _sfc_main = {
336
346
  this.$refs.progressCurrent.style.width = MoveX + "px";
337
347
  this.$refs.progressBar.style.left = MoveX - this.$refs.progressBar.clientWidth / 2 + "px";
338
348
  this.paused = false;
339
- if (window.location.protocol == "http:" && window.location.hostname !== "localhost" && this.betweenPlaying) {
349
+ if (!this.isHighPrecision() && this.betweenPlaying) {
340
350
  if (this.betweenEnd) {
341
351
  if (this.debuglog) {
342
352
  console.log(this.audio.currentTime);
@@ -253,6 +253,10 @@ export default {
253
253
  betweenEnd: {
254
254
  type: Number,
255
255
  default: 0
256
+ },
257
+ highPrecision: {
258
+ type: Boolean,
259
+ default: false
256
260
  }
257
261
  },
258
262
  data() {
@@ -437,8 +441,14 @@ export default {
437
441
  //
438
442
  }
439
443
  },
444
+ isHighPrecision() {
445
+ if (this.highPrecision) {
446
+ return true
447
+ }
448
+ return window.location.protocol === 'https:' || window.location.hostname === 'localhost'
449
+ },
440
450
  async startAudioCtx() {
441
- if (window.location.protocol == 'https:' || window.location.hostname === 'localhost') {
451
+ if (this.isHighPrecision()) {
442
452
  if (!this.audioCtx) {
443
453
  this.audioCtx = new (window.AudioContext || window.webkitAudioContext)();
444
454
  this.audioSource = this.audioCtx.createMediaElementSource(this.audio);
@@ -501,7 +511,7 @@ export default {
501
511
  this.$refs.progressCurrent.style.width = MoveX + 'px'
502
512
  this.$refs.progressBar.style.left = MoveX - (this.$refs.progressBar.clientWidth / 2) + 'px'
503
513
  this.paused = false
504
- if ((window.location.protocol == 'http:' && window.location.hostname !== 'localhost') && this.betweenPlaying) {
514
+ if (!this.isHighPrecision() && this.betweenPlaying) {
505
515
  if (this.betweenEnd) {
506
516
  if (this.debuglog) {
507
517
  console.log(this.audio.currentTime)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-audio",
3
- "version": "3.3.63",
3
+ "version": "3.3.64",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "liuxiangxiang <liuxiangxiang@94ai.com>",
@@ -14,7 +14,7 @@
14
14
  "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/nf-theme-chalk": "^3.3.63",
17
+ "@94ai/nf-theme-chalk": "^3.3.64",
18
18
  "vue-demi": "^0.14.5"
19
19
  },
20
20
  "peerDependenciesMeta": {
@@ -30,5 +30,5 @@
30
30
  "types": "lib/index.d.ts",
31
31
  "main": "lib/nf-audio.cjs.js",
32
32
  "module": "lib/nf-audio.esm-bundler.js",
33
- "gitHead": "0d3ffe687f3d24f59ce6c26e377f92df03bf82a9"
33
+ "gitHead": "e4fb754b3e4a7deb29d4200826491496fd813aa9"
34
34
  }