inl-ui 0.1.30 → 0.1.31

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.
@@ -12686,7 +12686,6 @@ async function audioToText(file) {
12686
12686
  function _isSlot(s) {
12687
12687
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
12688
12688
  }
12689
- let stream;
12690
12689
  const SpeechRecognition = vue.defineComponent({
12691
12690
  emits: ["change", "close"],
12692
12691
  setup(props, {
@@ -12697,40 +12696,42 @@ const SpeechRecognition = vue.defineComponent({
12697
12696
  const text = vue.ref("");
12698
12697
  const boxRef = vue.inject("boxRef");
12699
12698
  const startRecord = () => {
12700
- if (!stream) return;
12701
- text.value = "";
12702
- mediaRecorder = new MediaRecorder(stream);
12703
- mediaRecorder.start();
12704
- recording.value = true;
12705
- mediaRecorder.ondataavailable = e => {
12706
- const blob = new Blob([e.data], {
12707
- type: "audio/mp4"
12708
- });
12709
- const file = new File([blob], "recordedAudio.m4a", {
12710
- type: blob.type
12711
- });
12712
- audioToText(file).then(str => {
12713
- text.value = str;
12714
- }).catch(() => {
12715
- antDesignVue.message.error("\u8BED\u97F3\u8F6C\u6587\u5B57\u5931\u8D25");
12716
- });
12717
- };
12718
- mediaRecorder.onstop = () => recording.value = false;
12719
- };
12720
- vue.onMounted(() => {
12721
- if (!stream) {
12722
- navigator.mediaDevices.getUserMedia({
12723
- audio: true
12724
- }).then(s => {
12725
- stream = s;
12726
- startRecord();
12727
- }).catch(() => {
12728
- antDesignVue.message.warn("\u8BF7\u5F00\u542F\u5F55\u97F3\u6743\u9650");
12729
- });
12730
- } else {
12731
- startRecord();
12699
+ if (!navigator.mediaDevices) {
12700
+ antDesignVue.message.error("\u4E0D\u652F\u6301mediaDevices");
12701
+ return;
12732
12702
  }
12733
- });
12703
+ navigator.mediaDevices.getUserMedia({
12704
+ audio: true
12705
+ }).then(stream => {
12706
+ if (!MediaRecorder) {
12707
+ antDesignVue.message.error("\u4E0D\u652F\u6301MediaRecorder");
12708
+ }
12709
+ text.value = "";
12710
+ mediaRecorder = new MediaRecorder(stream);
12711
+ mediaRecorder.start();
12712
+ recording.value = true;
12713
+ mediaRecorder.ondataavailable = e => {
12714
+ const blob = new Blob([e.data], {
12715
+ type: "audio/mp4"
12716
+ });
12717
+ const file = new File([blob], "recordedAudio.m4a", {
12718
+ type: blob.type
12719
+ });
12720
+ audioToText(file).then(str => {
12721
+ text.value = str;
12722
+ }).catch(() => {
12723
+ antDesignVue.message.error("\u8BED\u97F3\u8F6C\u6587\u5B57\u5931\u8D25");
12724
+ });
12725
+ };
12726
+ mediaRecorder.onstop = () => {
12727
+ recording.value = false;
12728
+ stream.getTracks().forEach(track => track.stop());
12729
+ };
12730
+ }).catch(e => {
12731
+ antDesignVue.message.warn("\u8BF7\u5F00\u542F\u5F55\u97F3\u6743\u9650");
12732
+ });
12733
+ };
12734
+ vue.onMounted(startRecord);
12734
12735
  const handleStop = () => {
12735
12736
  if (mediaRecorder) {
12736
12737
  mediaRecorder.stop();
@@ -12675,7 +12675,6 @@ async function audioToText(file) {
12675
12675
  function _isSlot(s) {
12676
12676
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
12677
12677
  }
12678
- let stream;
12679
12678
  const SpeechRecognition = defineComponent({
12680
12679
  emits: ["change", "close"],
12681
12680
  setup(props, {
@@ -12686,40 +12685,42 @@ const SpeechRecognition = defineComponent({
12686
12685
  const text = ref("");
12687
12686
  const boxRef = inject("boxRef");
12688
12687
  const startRecord = () => {
12689
- if (!stream) return;
12690
- text.value = "";
12691
- mediaRecorder = new MediaRecorder(stream);
12692
- mediaRecorder.start();
12693
- recording.value = true;
12694
- mediaRecorder.ondataavailable = e => {
12695
- const blob = new Blob([e.data], {
12696
- type: "audio/mp4"
12697
- });
12698
- const file = new File([blob], "recordedAudio.m4a", {
12699
- type: blob.type
12700
- });
12701
- audioToText(file).then(str => {
12702
- text.value = str;
12703
- }).catch(() => {
12704
- message.error("\u8BED\u97F3\u8F6C\u6587\u5B57\u5931\u8D25");
12705
- });
12706
- };
12707
- mediaRecorder.onstop = () => recording.value = false;
12708
- };
12709
- onMounted(() => {
12710
- if (!stream) {
12711
- navigator.mediaDevices.getUserMedia({
12712
- audio: true
12713
- }).then(s => {
12714
- stream = s;
12715
- startRecord();
12716
- }).catch(() => {
12717
- message.warn("\u8BF7\u5F00\u542F\u5F55\u97F3\u6743\u9650");
12718
- });
12719
- } else {
12720
- startRecord();
12688
+ if (!navigator.mediaDevices) {
12689
+ message.error("\u4E0D\u652F\u6301mediaDevices");
12690
+ return;
12721
12691
  }
12722
- });
12692
+ navigator.mediaDevices.getUserMedia({
12693
+ audio: true
12694
+ }).then(stream => {
12695
+ if (!MediaRecorder) {
12696
+ message.error("\u4E0D\u652F\u6301MediaRecorder");
12697
+ }
12698
+ text.value = "";
12699
+ mediaRecorder = new MediaRecorder(stream);
12700
+ mediaRecorder.start();
12701
+ recording.value = true;
12702
+ mediaRecorder.ondataavailable = e => {
12703
+ const blob = new Blob([e.data], {
12704
+ type: "audio/mp4"
12705
+ });
12706
+ const file = new File([blob], "recordedAudio.m4a", {
12707
+ type: blob.type
12708
+ });
12709
+ audioToText(file).then(str => {
12710
+ text.value = str;
12711
+ }).catch(() => {
12712
+ message.error("\u8BED\u97F3\u8F6C\u6587\u5B57\u5931\u8D25");
12713
+ });
12714
+ };
12715
+ mediaRecorder.onstop = () => {
12716
+ recording.value = false;
12717
+ stream.getTracks().forEach(track => track.stop());
12718
+ };
12719
+ }).catch(e => {
12720
+ message.warn("\u8BF7\u5F00\u542F\u5F55\u97F3\u6743\u9650");
12721
+ });
12722
+ };
12723
+ onMounted(startRecord);
12723
12724
  const handleStop = () => {
12724
12725
  if (mediaRecorder) {
12725
12726
  mediaRecorder.stop();
package/dist/index.cjs CHANGED
@@ -45,7 +45,7 @@ var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
45
45
  var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
46
46
  var EZUIKit__default = /*#__PURE__*/_interopDefaultLegacy(EZUIKit);
47
47
 
48
- var version = "0.1.29";
48
+ var version = "0.1.30";
49
49
 
50
50
  const setTheme = theme => {
51
51
  if (theme === "dark") {
@@ -13689,7 +13689,6 @@ async function audioToText(file) {
13689
13689
  function _isSlot(s) {
13690
13690
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
13691
13691
  }
13692
- let stream;
13693
13692
  const SpeechRecognition = vue.defineComponent({
13694
13693
  emits: ["change", "close"],
13695
13694
  setup(props, {
@@ -13700,40 +13699,42 @@ const SpeechRecognition = vue.defineComponent({
13700
13699
  const text = vue.ref("");
13701
13700
  const boxRef = vue.inject("boxRef");
13702
13701
  const startRecord = () => {
13703
- if (!stream) return;
13704
- text.value = "";
13705
- mediaRecorder = new MediaRecorder(stream);
13706
- mediaRecorder.start();
13707
- recording.value = true;
13708
- mediaRecorder.ondataavailable = e => {
13709
- const blob = new Blob([e.data], {
13710
- type: "audio/mp4"
13711
- });
13712
- const file = new File([blob], "recordedAudio.m4a", {
13713
- type: blob.type
13714
- });
13715
- audioToText(file).then(str => {
13716
- text.value = str;
13717
- }).catch(() => {
13718
- antDesignVue.message.error("\u8BED\u97F3\u8F6C\u6587\u5B57\u5931\u8D25");
13719
- });
13720
- };
13721
- mediaRecorder.onstop = () => recording.value = false;
13722
- };
13723
- vue.onMounted(() => {
13724
- if (!stream) {
13725
- navigator.mediaDevices.getUserMedia({
13726
- audio: true
13727
- }).then(s => {
13728
- stream = s;
13729
- startRecord();
13730
- }).catch(() => {
13731
- antDesignVue.message.warn("\u8BF7\u5F00\u542F\u5F55\u97F3\u6743\u9650");
13732
- });
13733
- } else {
13734
- startRecord();
13702
+ if (!navigator.mediaDevices) {
13703
+ antDesignVue.message.error("\u4E0D\u652F\u6301mediaDevices");
13704
+ return;
13735
13705
  }
13736
- });
13706
+ navigator.mediaDevices.getUserMedia({
13707
+ audio: true
13708
+ }).then(stream => {
13709
+ if (!MediaRecorder) {
13710
+ antDesignVue.message.error("\u4E0D\u652F\u6301MediaRecorder");
13711
+ }
13712
+ text.value = "";
13713
+ mediaRecorder = new MediaRecorder(stream);
13714
+ mediaRecorder.start();
13715
+ recording.value = true;
13716
+ mediaRecorder.ondataavailable = e => {
13717
+ const blob = new Blob([e.data], {
13718
+ type: "audio/mp4"
13719
+ });
13720
+ const file = new File([blob], "recordedAudio.m4a", {
13721
+ type: blob.type
13722
+ });
13723
+ audioToText(file).then(str => {
13724
+ text.value = str;
13725
+ }).catch(() => {
13726
+ antDesignVue.message.error("\u8BED\u97F3\u8F6C\u6587\u5B57\u5931\u8D25");
13727
+ });
13728
+ };
13729
+ mediaRecorder.onstop = () => {
13730
+ recording.value = false;
13731
+ stream.getTracks().forEach(track => track.stop());
13732
+ };
13733
+ }).catch(e => {
13734
+ antDesignVue.message.warn("\u8BF7\u5F00\u542F\u5F55\u97F3\u6743\u9650");
13735
+ });
13736
+ };
13737
+ vue.onMounted(startRecord);
13737
13738
  const handleStop = () => {
13738
13739
  if (mediaRecorder) {
13739
13740
  mediaRecorder.stop();
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ import { Key } from 'ant-design-vue/lib/table/interface';
11
11
  import * as vue_jsx_runtime from 'vue/jsx-runtime';
12
12
  import * as _ant_design_icons_vue_lib_components_IconFont from '@ant-design/icons-vue/lib/components/IconFont';
13
13
 
14
- var version = "0.1.29";
14
+ var version = "0.1.30";
15
15
 
16
16
  declare const _default$p: {
17
17
  set(theme: string): void;
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import { XPopup, CommentBlock, setAxiosOption } from '@sszj-temp/mobile';
14
14
  import { marked } from 'marked';
15
15
  import '@sszj-temp/mobile/style.css';
16
16
 
17
- var version = "0.1.29";
17
+ var version = "0.1.30";
18
18
 
19
19
  const setTheme = theme => {
20
20
  if (theme === "dark") {
@@ -13658,7 +13658,6 @@ async function audioToText(file) {
13658
13658
  function _isSlot(s) {
13659
13659
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
13660
13660
  }
13661
- let stream;
13662
13661
  const SpeechRecognition = defineComponent({
13663
13662
  emits: ["change", "close"],
13664
13663
  setup(props, {
@@ -13669,40 +13668,42 @@ const SpeechRecognition = defineComponent({
13669
13668
  const text = ref("");
13670
13669
  const boxRef = inject("boxRef");
13671
13670
  const startRecord = () => {
13672
- if (!stream) return;
13673
- text.value = "";
13674
- mediaRecorder = new MediaRecorder(stream);
13675
- mediaRecorder.start();
13676
- recording.value = true;
13677
- mediaRecorder.ondataavailable = e => {
13678
- const blob = new Blob([e.data], {
13679
- type: "audio/mp4"
13680
- });
13681
- const file = new File([blob], "recordedAudio.m4a", {
13682
- type: blob.type
13683
- });
13684
- audioToText(file).then(str => {
13685
- text.value = str;
13686
- }).catch(() => {
13687
- message.error("\u8BED\u97F3\u8F6C\u6587\u5B57\u5931\u8D25");
13688
- });
13689
- };
13690
- mediaRecorder.onstop = () => recording.value = false;
13691
- };
13692
- onMounted(() => {
13693
- if (!stream) {
13694
- navigator.mediaDevices.getUserMedia({
13695
- audio: true
13696
- }).then(s => {
13697
- stream = s;
13698
- startRecord();
13699
- }).catch(() => {
13700
- message.warn("\u8BF7\u5F00\u542F\u5F55\u97F3\u6743\u9650");
13701
- });
13702
- } else {
13703
- startRecord();
13671
+ if (!navigator.mediaDevices) {
13672
+ message.error("\u4E0D\u652F\u6301mediaDevices");
13673
+ return;
13704
13674
  }
13705
- });
13675
+ navigator.mediaDevices.getUserMedia({
13676
+ audio: true
13677
+ }).then(stream => {
13678
+ if (!MediaRecorder) {
13679
+ message.error("\u4E0D\u652F\u6301MediaRecorder");
13680
+ }
13681
+ text.value = "";
13682
+ mediaRecorder = new MediaRecorder(stream);
13683
+ mediaRecorder.start();
13684
+ recording.value = true;
13685
+ mediaRecorder.ondataavailable = e => {
13686
+ const blob = new Blob([e.data], {
13687
+ type: "audio/mp4"
13688
+ });
13689
+ const file = new File([blob], "recordedAudio.m4a", {
13690
+ type: blob.type
13691
+ });
13692
+ audioToText(file).then(str => {
13693
+ text.value = str;
13694
+ }).catch(() => {
13695
+ message.error("\u8BED\u97F3\u8F6C\u6587\u5B57\u5931\u8D25");
13696
+ });
13697
+ };
13698
+ mediaRecorder.onstop = () => {
13699
+ recording.value = false;
13700
+ stream.getTracks().forEach(track => track.stop());
13701
+ };
13702
+ }).catch(e => {
13703
+ message.warn("\u8BF7\u5F00\u542F\u5F55\u97F3\u6743\u9650");
13704
+ });
13705
+ };
13706
+ onMounted(startRecord);
13706
13707
  const handleStop = () => {
13707
13708
  if (mediaRecorder) {
13708
13709
  mediaRecorder.stop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inl-ui",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
4
4
  "description": "工业 pc ui库",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",