|
@@ -7,7 +7,9 @@ import { router, user } from '@/.cool'
|
|
|
const isLoading = ref(true)
|
|
const isLoading = ref(true)
|
|
|
const showControls = ref(true)
|
|
const showControls = ref(true)
|
|
|
const showVideo = ref(true)
|
|
const showVideo = ref(true)
|
|
|
|
|
+import { useUi } from "@/uni_modules/cool-ui";
|
|
|
|
|
|
|
|
|
|
+const ui = useUi();
|
|
|
const data = ref({
|
|
const data = ref({
|
|
|
videoSrc: '',
|
|
videoSrc: '',
|
|
|
webviewSrc: '',
|
|
webviewSrc: '',
|
|
@@ -209,15 +211,40 @@ function handleTop() {
|
|
|
progress2.value = 5
|
|
progress2.value = 5
|
|
|
}
|
|
}
|
|
|
function startRecord() {
|
|
function startRecord() {
|
|
|
- console.log('开始录音');
|
|
|
|
|
- timer.value = setInterval(() => {
|
|
|
|
|
- timers.value--
|
|
|
|
|
- console.log(timers.value);
|
|
|
|
|
- if (timers.value <= 0) {
|
|
|
|
|
- endRecord()
|
|
|
|
|
- }
|
|
|
|
|
- }, 800)
|
|
|
|
|
- recorderManager.value.start();
|
|
|
|
|
|
|
+ const res = uni.getAppAuthorizeSetting()
|
|
|
|
|
+ console.log(res);
|
|
|
|
|
+ if (res.microphoneAuthorized == 'authorized') {
|
|
|
|
|
+ console.log('开始录音');
|
|
|
|
|
+ timer.value = setInterval(() => {
|
|
|
|
|
+ timers.value--
|
|
|
|
|
+ console.log(timers.value);
|
|
|
|
|
+ if (timers.value <= 0) {
|
|
|
|
|
+ endRecord()
|
|
|
|
|
+ }
|
|
|
|
|
+ }, 800)
|
|
|
|
|
+ recorderManager.value.start();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ui.showConfirm({
|
|
|
|
|
+ title: "获取麦克风权限",
|
|
|
|
|
+ message: "本应用仅在你主动触发录音操作时调用麦克风,仅用于临时实时录音,录音内容仅在当前页面本地播放,供你本人收听。你可随时在系统设置中关闭麦克风权限,关闭后将无法使用录音功能,不影响应用其他功能正常使用",
|
|
|
|
|
+ callback(action) {
|
|
|
|
|
+ if (action === "confirm") {
|
|
|
|
|
+ console.log('开始录音');
|
|
|
|
|
+ timer.value = setInterval(() => {
|
|
|
|
|
+ timers.value--
|
|
|
|
|
+ console.log(timers.value);
|
|
|
|
|
+ if (timers.value <= 0) {
|
|
|
|
|
+ endRecord()
|
|
|
|
|
+ }
|
|
|
|
|
+ }, 800)
|
|
|
|
|
+ recorderManager.value.start();
|
|
|
|
|
+ // 执行删除操作
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log("用户取消操作");
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
function endRecord() {
|
|
function endRecord() {
|
|
|
clearInterval(timer.value)
|
|
clearInterval(timer.value)
|