identity-verify.js 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const _sfc_main = {
  4. name: "IdentityVerify",
  5. data() {
  6. return {
  7. loading: false,
  8. responses: [],
  9. processedResponses: [],
  10. assistantResponse: "",
  11. audioTranscript: "",
  12. videoPlaying: false,
  13. showDebugInfo: false,
  14. // 设置为true可以显示调试信息
  15. videoUrl: "http://121.36.251.245:9000/minlong/9c139c99-a613-49f2-986b-8a3ac20a9b1b.mp4",
  16. // 用于存储AI数字人视频URL
  17. showReplayButton: false,
  18. cameraStream: null,
  19. // 存储摄像头流
  20. cameraError: null,
  21. // 存储摄像头错误信息
  22. useMiniProgramCameraComponent: false,
  23. // 添加小程序相机组件标志
  24. cameraContext: null,
  25. // 添加相机上下文
  26. currentSubtitle: "",
  27. subtitles: [
  28. {
  29. startTime: 0,
  30. // 开始时间(秒)
  31. endTime: 5,
  32. // 结束时间(秒)
  33. text: "你好,我是本次面试的面试官,欢迎参加本公司的线上面试!"
  34. },
  35. {
  36. startTime: 5,
  37. endTime: 13,
  38. text: "面试预计需要15分钟,请你提前安排在网络良好、光线亮度合适、且相对安静的环境参加这次面试"
  39. },
  40. {
  41. startTime: 13,
  42. endTime: 20,
  43. text: "以免影响本次面试的结果。如果你在面试过程中遇到问题,请与我们的招聘人员联系。"
  44. }
  45. ],
  46. secondVideoSubtitles: [
  47. {
  48. startTime: 0,
  49. endTime: 10,
  50. text: "请结合您的基本信息与过往履历进行简单的自我介绍,并讲一讲您有哪些优势胜任本岗位:"
  51. }
  52. ],
  53. thirdVideoSubtitles: [
  54. {
  55. startTime: 0,
  56. endTime: 3,
  57. text: "在工作中,你如何确保个人防护装备的正确使用?"
  58. }
  59. ],
  60. fourthVideoSubtitles: [
  61. {
  62. startTime: 0,
  63. endTime: 3,
  64. text: "描述一次你与团队合作改善生产流程的经历。"
  65. }
  66. ],
  67. fifthVideoSubtitles: [
  68. {
  69. startTime: 0,
  70. endTime: 6,
  71. text: "你在团队合作中曾遇到过哪些挑战?如何解决团队内部的分歧?"
  72. }
  73. ],
  74. sixthVideoSubtitles: [
  75. {
  76. startTime: 0,
  77. endTime: 5,
  78. text: "您已完成本次面试全部题目,请问您对于这个岗位还有什么想要了解的吗?"
  79. }
  80. ],
  81. showAnswerButton: false,
  82. // 控制答题按钮显示
  83. currentVideoIndex: 0,
  84. // 当前播放的视频索引
  85. videoList: [
  86. "http://121.36.251.245:9000/minlong/9c139c99-a613-49f2-986b-8a3ac20a9b1b.mp4",
  87. // 第一段视频
  88. "http://121.36.251.245:9000/minlong/15467aca-2c1e-4d40-bebc-11fc984f0a24.mp4",
  89. // 第二段视频
  90. "http://121.36.251.245:9000/minlong/a96f295c-ecba-4b08-b627-0ed0dc72d727.mp4",
  91. // 第三段视频
  92. "http://121.36.251.245:9000/minlong/e152eb38-7e03-4bb0-8b8d-73d51342d2aa.mp4",
  93. "http://121.36.251.245:9000/minlong/6381eec3-1373-400f-aa8c-e229b60522ea.mp4",
  94. "http://121.36.251.245:9000/minlong/2a11fe78-38d5-4af3-91c8-a080feb122e0.mp4"
  95. //结束
  96. ],
  97. isRecording: false,
  98. recordingTimer: null,
  99. showStopRecordingButton: false,
  100. mediaRecorder: null,
  101. recordedChunks: [],
  102. recorder: null,
  103. lastUploadedVideoUrl: "",
  104. showStartRecordingButton: false
  105. };
  106. },
  107. mounted() {
  108. this.playDigitalHumanVideo();
  109. this.checkAudioPermission();
  110. this.initCamera();
  111. setTimeout(() => {
  112. if (this.cameraStream && !this.useMiniProgramCameraComponent) {
  113. this.testAudioInput();
  114. }
  115. }, 3e3);
  116. },
  117. beforeDestroy() {
  118. this.stopUserCamera();
  119. },
  120. methods: {
  121. // 初始化相机
  122. async initCamera() {
  123. const systemInfo = common_vendor.index.getSystemInfoSync();
  124. const isMiniProgram = systemInfo.uniPlatform === "mp-weixin" || systemInfo.uniPlatform === "mp-alipay" || systemInfo.uniPlatform === "mp-baidu";
  125. if (isMiniProgram) {
  126. this.useMiniProgramCameraComponent = true;
  127. this.cameraContext = common_vendor.index.createCameraContext();
  128. common_vendor.index.getSetting({
  129. success: (res) => {
  130. if (!res.authSetting["scope.record"]) {
  131. common_vendor.index.authorize({
  132. scope: "scope.record",
  133. success: () => {
  134. console.log("录音权限已获取");
  135. },
  136. fail: (err) => {
  137. console.error("录音权限获取失败:", err);
  138. this.showPermissionDialog("录音");
  139. }
  140. });
  141. }
  142. if (!res.authSetting["scope.camera"]) {
  143. common_vendor.index.authorize({
  144. scope: "scope.camera",
  145. success: () => {
  146. console.log("相机权限已获取");
  147. },
  148. fail: (err) => {
  149. console.error("相机权限获取失败:", err);
  150. this.showPermissionDialog("相机");
  151. }
  152. });
  153. }
  154. }
  155. });
  156. } else {
  157. try {
  158. const constraints = {
  159. audio: {
  160. echoCancellation: true,
  161. noiseSuppression: true,
  162. autoGainControl: true
  163. },
  164. video: {
  165. width: { ideal: 640 },
  166. height: { ideal: 480 },
  167. facingMode: "user"
  168. }
  169. };
  170. const stream = await navigator.mediaDevices.getUserMedia(constraints);
  171. this.cameraStream = stream;
  172. const audioTracks = stream.getAudioTracks();
  173. console.log("音频轨道数量:", audioTracks.length);
  174. if (audioTracks.length > 0) {
  175. console.log("音频轨道已获取:", audioTracks[0].label);
  176. audioTracks[0].enabled = true;
  177. } else {
  178. console.warn("未检测到音频轨道,尝试单独获取音频");
  179. this.tryGetAudioOnly();
  180. }
  181. const videoElement = this.$refs.userCameraVideo;
  182. if (videoElement) {
  183. videoElement.srcObject = stream;
  184. videoElement.muted = true;
  185. }
  186. } catch (error) {
  187. console.error("获取摄像头失败:", error);
  188. this.cameraError = error.message || "无法访问摄像头";
  189. common_vendor.index.showToast({
  190. title: "无法访问摄像头,请检查权限设置",
  191. icon: "none"
  192. });
  193. }
  194. }
  195. },
  196. // 停止用户摄像头
  197. stopUserCamera() {
  198. if (this.cameraStream) {
  199. this.cameraStream.getTracks().forEach((track) => {
  200. track.stop();
  201. });
  202. this.cameraStream = null;
  203. }
  204. },
  205. async fetchData() {
  206. this.loading = true;
  207. this.assistantResponse = "";
  208. this.audioTranscript = "";
  209. this.processedResponses = [];
  210. try {
  211. const requestTask = common_vendor.index.request({
  212. url: "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",
  213. method: "POST",
  214. header: {
  215. "Content-Type": "application/json",
  216. "Authorization": "Bearer sk-9e1ec73a7d97493b8613c63f06b6110c"
  217. },
  218. data: {
  219. "model": "qwen-omni-turbo",
  220. "messages": [
  221. {
  222. "role": "user",
  223. "content": [
  224. {
  225. "type": "input_audio",
  226. "input_audio": {
  227. "data": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250211/tixcef/cherry.wav",
  228. "format": "wav"
  229. }
  230. },
  231. {
  232. "type": "text",
  233. "text": "这段音频在说什么"
  234. }
  235. ]
  236. }
  237. ],
  238. "stream": true,
  239. "stream_options": {
  240. "include_usage": true
  241. },
  242. "modalities": ["text", "audio"],
  243. "audio": { "voice": "Cherry", "format": "wav" }
  244. },
  245. success: (res) => {
  246. console.log("请求成功,响应数据:", res.data);
  247. if (typeof res.data === "string" && res.data.includes("data: {")) {
  248. const chunks = res.data.split("data: ").filter((chunk) => chunk.trim() !== "");
  249. chunks.forEach((chunk) => {
  250. this.handleStreamResponse(chunk);
  251. });
  252. } else {
  253. this.handleStreamResponse(res.data);
  254. }
  255. this.playDigitalHumanVideo();
  256. },
  257. fail: (err) => {
  258. console.error("请求失败:", err);
  259. },
  260. complete: () => {
  261. this.loading = false;
  262. }
  263. });
  264. } catch (error) {
  265. console.error("获取数据失败:", error);
  266. this.loading = false;
  267. }
  268. },
  269. handleStreamResponse(data) {
  270. if (typeof data === "string") {
  271. if (data === "[DONE]")
  272. return;
  273. try {
  274. const cleanData = data.trim();
  275. if (cleanData.startsWith("{") && cleanData.endsWith("}")) {
  276. const jsonData = JSON.parse(cleanData);
  277. this.processStreamChunk(jsonData);
  278. }
  279. } catch (e) {
  280. console.error("解析JSON失败:", e, "原始数据:", data);
  281. }
  282. } else {
  283. this.processStreamChunk(data);
  284. }
  285. },
  286. processStreamChunk(chunk) {
  287. if (chunk.choices && chunk.choices.length > 0) {
  288. const choice = chunk.choices[0];
  289. if (choice.delta && choice.delta.content) {
  290. this.assistantResponse += choice.delta.content;
  291. }
  292. if (choice.delta && choice.delta.audio && choice.delta.audio.transcript) {
  293. this.audioTranscript += choice.delta.audio.transcript;
  294. }
  295. if (choice.delta) {
  296. const result = {};
  297. if (choice.delta.role) {
  298. result.role = choice.delta.role;
  299. }
  300. if (choice.delta.audio && choice.delta.audio.transcript) {
  301. result.transcript = choice.delta.audio.transcript;
  302. }
  303. if (Object.keys(result).length > 0) {
  304. this.processedResponses.push(result);
  305. }
  306. }
  307. }
  308. },
  309. processResponseData() {
  310. this.processedResponses = this.responses.map((item) => {
  311. const result = {};
  312. if (item.delta && item.delta.role) {
  313. result.role = item.delta.role;
  314. }
  315. if (item.delta && item.delta.audio && item.delta.audio.transcript) {
  316. result.transcript = item.delta.audio.transcript;
  317. }
  318. return result;
  319. }).filter((item) => Object.keys(item).length > 0);
  320. },
  321. // 播放数字人视频
  322. playDigitalHumanVideo() {
  323. this.videoUrl = this.videoList[this.currentVideoIndex];
  324. this.videoPlaying = true;
  325. this.$nextTick(() => {
  326. const videoContext = common_vendor.index.createVideoContext("myVideo", this);
  327. if (videoContext) {
  328. videoContext.play();
  329. setTimeout(() => {
  330. if (this.videoPlaying && this.$refs.videoPlayer) {
  331. console.log("视频应该正在播放");
  332. } else {
  333. console.log("视频可能未成功播放,尝试替代方案");
  334. this.tryAlternativeVideoPath();
  335. }
  336. }, 1e3);
  337. } else {
  338. console.error("无法创建视频上下文");
  339. this.tryAlternativeVideoPath();
  340. }
  341. });
  342. },
  343. // 修改 tryAlternativeVideoPath 方法
  344. tryAlternativeVideoPath() {
  345. console.log("尝试使用替代路径");
  346. const alternativePaths = [
  347. "./static/demo.mp4",
  348. "../static/demo.mp4",
  349. "static/demo.mp4",
  350. "/static/demo.mp4",
  351. // 添加绝对路径
  352. `${window.location.origin}/static/demo.mp4`
  353. ];
  354. const currentPathIndex = alternativePaths.indexOf(this.videoUrl);
  355. const nextPathIndex = (currentPathIndex + 1) % alternativePaths.length;
  356. this.videoUrl = alternativePaths[nextPathIndex];
  357. console.log("尝试新路径:", this.videoUrl);
  358. this.$nextTick(() => {
  359. const videoContext = common_vendor.index.createVideoContext("myVideo", this);
  360. if (videoContext) {
  361. videoContext.stop();
  362. videoContext.play();
  363. setTimeout(() => {
  364. if (nextPathIndex === alternativePaths.length - 1 && !this.videoPlaying) {
  365. console.log("所有路径均失败,尝试使用uni.getVideoInfo检查视频");
  366. this.checkVideoWithAPI();
  367. }
  368. }, 1e3);
  369. }
  370. });
  371. },
  372. // 添加新方法:使用uni API检查视频
  373. checkVideoWithAPI() {
  374. common_vendor.index.getVideoInfo({
  375. src: "/static/demo.mp4",
  376. success: (res) => {
  377. console.log("视频信息获取成功:", res);
  378. this.videoUrl = "/static/demo.mp4";
  379. this.$nextTick(() => {
  380. const videoContext = common_vendor.index.createVideoContext("myVideo", this);
  381. if (videoContext) {
  382. videoContext.play();
  383. }
  384. });
  385. },
  386. fail: (err) => {
  387. console.error("视频信息获取失败:", err);
  388. this.fallbackToLocalVideo();
  389. }
  390. });
  391. },
  392. // 添加新方法:回退到本地视频
  393. fallbackToLocalVideo() {
  394. console.log("尝试使用本地视频资源");
  395. const platform = common_vendor.index.getSystemInfoSync().platform;
  396. if (platform === "android" || platform === "ios") {
  397. this.videoUrl = platform === "android" ? "android.resource://package_name/raw/demo" : "file:///assets/demo.mp4";
  398. this.$nextTick(() => {
  399. const videoContext = common_vendor.index.createVideoContext("myVideo", this);
  400. if (videoContext) {
  401. videoContext.play();
  402. }
  403. });
  404. } else {
  405. this.videoPlaying = false;
  406. common_vendor.index.showToast({
  407. title: "视频加载失败,显示静态图片",
  408. icon: "none"
  409. });
  410. }
  411. },
  412. // 修改 handleVideoError 方法
  413. handleVideoError(e) {
  414. console.error("视频加载错误:", e);
  415. if (e && e.detail) {
  416. console.error("详细错误信息:", e.detail);
  417. }
  418. common_vendor.index.getFileInfo({
  419. filePath: this.videoUrl.startsWith("/") ? this.videoUrl.substring(1) : this.videoUrl,
  420. success: (res) => {
  421. console.log("文件存在,大小:", res.size);
  422. this.tryDifferentFormat();
  423. },
  424. fail: (err) => {
  425. console.error("文件不存在或无法访问:", err);
  426. this.tryAlternativeVideoPath();
  427. }
  428. });
  429. common_vendor.index.showToast({
  430. title: "视频加载失败,请检查文件是否存在",
  431. icon: "none",
  432. duration: 2e3
  433. });
  434. },
  435. // 添加新方法:尝试不同格式
  436. tryDifferentFormat() {
  437. console.log("尝试不同的视频格式");
  438. const formats = [
  439. { ext: "mp4", mime: "video/mp4" },
  440. { ext: "webm", mime: "video/webm" },
  441. { ext: "ogg", mime: "video/ogg" },
  442. { ext: "mov", mime: "video/quicktime" }
  443. ];
  444. const currentPath = this.videoUrl;
  445. const basePath = currentPath.substring(0, currentPath.lastIndexOf(".")) || "/static/demo";
  446. let nextFormat = formats.find((f) => !currentPath.endsWith(f.ext));
  447. if (nextFormat) {
  448. this.videoUrl = `${basePath}.${nextFormat.ext}`;
  449. console.log("尝试新格式:", this.videoUrl);
  450. this.$nextTick(() => {
  451. const videoContext = common_vendor.index.createVideoContext("myVideo", this);
  452. if (videoContext) {
  453. videoContext.stop();
  454. videoContext.play();
  455. }
  456. });
  457. } else {
  458. this.useBuiltInResource();
  459. }
  460. },
  461. // 添加新方法:使用内置资源
  462. useBuiltInResource() {
  463. console.log("尝试使用内置资源");
  464. const platform = common_vendor.index.getSystemInfoSync().platform;
  465. if (platform === "windows") {
  466. process.env.UNI_INPUT_DIR || "";
  467. this.videoUrl = `./static/demo.mp4`;
  468. console.log("Windows平台尝试路径:", this.videoUrl);
  469. } else if (platform === "android" || platform === "ios") {
  470. this.useNativeVideo();
  471. } else {
  472. const baseUrl = window.location.origin;
  473. this.videoUrl = `${baseUrl}/static/demo.mp4`;
  474. console.log("Web平台尝试URL:", this.videoUrl);
  475. }
  476. this.$nextTick(() => {
  477. const videoContext = common_vendor.index.createVideoContext("myVideo", this);
  478. if (videoContext) {
  479. videoContext.play();
  480. }
  481. });
  482. },
  483. // 添加新方法:使用原生视频能力
  484. useNativeVideo() {
  485. console.log("尝试使用原生视频能力");
  486. common_vendor.index.chooseVideo({
  487. sourceType: ["album"],
  488. success: (res) => {
  489. this.videoUrl = res.tempFilePath;
  490. this.$nextTick(() => {
  491. const videoContext = common_vendor.index.createVideoContext("myVideo", this);
  492. if (videoContext) {
  493. videoContext.play();
  494. }
  495. });
  496. },
  497. fail: () => {
  498. this.videoPlaying = false;
  499. common_vendor.index.showToast({
  500. title: "无法加载视频,显示静态图片",
  501. icon: "none"
  502. });
  503. }
  504. });
  505. },
  506. // 处理视频结束事件
  507. handleVideoEnded() {
  508. console.log("视频播放结束");
  509. this.videoPlaying = false;
  510. if (this.currentVideoIndex >= 1) {
  511. this.showStartRecordingButton = true;
  512. } else {
  513. this.showAnswerButton = true;
  514. }
  515. },
  516. // 添加新方法:开始录制用户回答
  517. startRecordingAnswer() {
  518. console.log("开始录制用户回答");
  519. this.isRecording = true;
  520. const systemInfo = common_vendor.index.getSystemInfoSync();
  521. const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith("mp-");
  522. if (isMiniProgram) {
  523. this.startMiniProgramRecording();
  524. } else {
  525. this.startBrowserRecording();
  526. }
  527. this.showStopRecordingButton = true;
  528. },
  529. // 修改小程序环境下的录制方法
  530. startMiniProgramRecording() {
  531. if (!this.cameraContext) {
  532. this.cameraContext = common_vendor.index.createCameraContext();
  533. }
  534. common_vendor.index.getSetting({
  535. success: (res) => {
  536. const hasRecordAuth = res.authSetting["scope.record"];
  537. const hasCameraAuth = res.authSetting["scope.camera"];
  538. if (!hasRecordAuth || !hasCameraAuth) {
  539. console.warn("缺少必要权限,请求权限");
  540. this.requestMiniProgramPermissions();
  541. return;
  542. }
  543. const options = {
  544. timeout: 6e4,
  545. // 最长录制60秒
  546. success: () => {
  547. console.log("小程序录像开始成功");
  548. },
  549. fail: (err) => {
  550. console.error("小程序录像开始失败:", err);
  551. common_vendor.index.showToast({
  552. title: "录制失败,请检查相机权限",
  553. icon: "none"
  554. });
  555. this.proceedToNextQuestion();
  556. },
  557. timeoutCallback: () => {
  558. console.log("录制超时自动停止");
  559. this.stopRecordingAnswer();
  560. }
  561. };
  562. this.recorder = this.cameraContext.startRecord(options);
  563. }
  564. });
  565. },
  566. // 添加新方法:请求小程序权限
  567. requestMiniProgramPermissions() {
  568. common_vendor.index.authorize({
  569. scope: "scope.record",
  570. success: () => {
  571. console.log("录音权限已获取");
  572. common_vendor.index.authorize({
  573. scope: "scope.camera",
  574. success: () => {
  575. console.log("相机权限已获取");
  576. this.startMiniProgramRecording();
  577. },
  578. fail: (err) => {
  579. console.error("相机权限获取失败:", err);
  580. this.showPermissionDialog("相机");
  581. }
  582. });
  583. },
  584. fail: (err) => {
  585. console.error("录音权限获取失败:", err);
  586. this.showPermissionDialog("录音");
  587. }
  588. });
  589. },
  590. // 修改浏览器环境下的录制方法
  591. startBrowserRecording() {
  592. if (!this.cameraStream) {
  593. console.error("没有可用的摄像头流");
  594. common_vendor.index.showToast({
  595. title: "录制失败,摄像头未就绪",
  596. icon: "none"
  597. });
  598. this.proceedToNextQuestion();
  599. return;
  600. }
  601. try {
  602. const hasAudio = this.cameraStream.getAudioTracks().length > 0;
  603. if (!hasAudio) {
  604. console.warn("警告:媒体流中没有音频轨道,尝试重新获取带音频的媒体流");
  605. navigator.mediaDevices.getUserMedia({
  606. audio: {
  607. echoCancellation: true,
  608. noiseSuppression: true,
  609. autoGainControl: true
  610. },
  611. video: true
  612. }).then((newStream) => {
  613. const audioTracks = newStream.getAudioTracks();
  614. if (audioTracks.length > 0) {
  615. console.log("成功获取音频轨道:", audioTracks[0].label);
  616. const videoTrack = this.cameraStream.getVideoTracks()[0];
  617. const audioTrack = newStream.getAudioTracks()[0];
  618. const combinedStream = new MediaStream();
  619. if (videoTrack)
  620. combinedStream.addTrack(videoTrack);
  621. if (audioTrack)
  622. combinedStream.addTrack(audioTrack);
  623. this.cameraStream = combinedStream;
  624. const videoElement = this.$refs.userCameraVideo;
  625. if (videoElement) {
  626. videoElement.srcObject = combinedStream;
  627. videoElement.muted = true;
  628. }
  629. this.setupMediaRecorder(combinedStream);
  630. } else {
  631. console.warn("仍然无法获取音频轨道");
  632. this.setupMediaRecorder(this.cameraStream);
  633. }
  634. }).catch((err) => {
  635. console.error("获取音频失败:", err);
  636. this.setupMediaRecorder(this.cameraStream);
  637. });
  638. } else {
  639. console.log("检测到音频轨道,直接使用");
  640. this.setupMediaRecorder(this.cameraStream);
  641. }
  642. } catch (error) {
  643. console.error("浏览器录制失败:", error);
  644. common_vendor.index.showToast({
  645. title: "录制失败,浏览器可能不支持此功能",
  646. icon: "none"
  647. });
  648. this.proceedToNextQuestion();
  649. }
  650. },
  651. // 修改 setupMediaRecorder 方法
  652. setupMediaRecorder(stream) {
  653. const videoTracks = stream.getVideoTracks();
  654. const audioTracks = stream.getAudioTracks();
  655. console.log("设置MediaRecorder - 视频轨道:", videoTracks.length, "音频轨道:", audioTracks.length);
  656. let mimeType = "";
  657. const supportedTypes = [
  658. "video/webm;codecs=vp9,opus",
  659. "video/webm;codecs=vp8,opus",
  660. "video/webm;codecs=h264,opus",
  661. "video/mp4;codecs=h264,aac",
  662. "video/webm",
  663. "video/mp4"
  664. ];
  665. for (const type of supportedTypes) {
  666. if (MediaRecorder.isTypeSupported(type)) {
  667. mimeType = type;
  668. console.log("使用支持的MIME类型:", mimeType);
  669. break;
  670. }
  671. }
  672. const options = {
  673. mimeType: mimeType || "",
  674. audioBitsPerSecond: 128e3,
  675. videoBitsPerSecond: 25e5
  676. };
  677. try {
  678. this.mediaRecorder = new MediaRecorder(stream, options);
  679. console.log("MediaRecorder创建成功,使用选项:", options);
  680. } catch (e) {
  681. console.warn("使用指定选项创建MediaRecorder失败,尝试使用默认选项");
  682. this.mediaRecorder = new MediaRecorder(stream);
  683. }
  684. this.recordedChunks = [];
  685. this.mediaRecorder.ondataavailable = (event) => {
  686. if (event.data && event.data.size > 0) {
  687. this.recordedChunks.push(event.data);
  688. console.log(`收到数据块: ${event.data.size} 字节`);
  689. }
  690. };
  691. this.mediaRecorder.onstop = () => {
  692. console.log("MediaRecorder停止,数据块数量:", this.recordedChunks.length);
  693. if (this.recordedChunks.length === 0) {
  694. console.error("没有录制到数据");
  695. common_vendor.index.showToast({
  696. title: "录制失败,未捕获到数据",
  697. icon: "none"
  698. });
  699. this.proceedToNextQuestion();
  700. return;
  701. }
  702. const mimeType2 = this.mediaRecorder.mimeType || "video/webm";
  703. const blob = new Blob(this.recordedChunks, { type: mimeType2 });
  704. console.log("创建Blob,大小:", blob.size, "类型:", mimeType2);
  705. const fileName = `answer_${this.currentVideoIndex}_${Date.now()}.webm`;
  706. const file = new File([blob], fileName, { type: mimeType2 });
  707. this.uploadRecordedVideo(file);
  708. };
  709. this.mediaRecorder.onerror = (event) => {
  710. console.error("MediaRecorder错误:", event.error);
  711. };
  712. try {
  713. this.mediaRecorder.start(1e3);
  714. console.log("MediaRecorder开始录制");
  715. } catch (e) {
  716. console.error("开始录制失败:", e);
  717. }
  718. },
  719. // 添加新方法:停止录制用户回答
  720. stopRecordingAnswer() {
  721. console.log("停止录制用户回答");
  722. this.isRecording = false;
  723. if (this.recordingTimer) {
  724. clearTimeout(this.recordingTimer);
  725. this.recordingTimer = null;
  726. }
  727. common_vendor.index.hideLoading();
  728. this.showStopRecordingButton = false;
  729. const systemInfo = common_vendor.index.getSystemInfoSync();
  730. const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith("mp-");
  731. if (isMiniProgram) {
  732. this.stopMiniProgramRecording();
  733. } else {
  734. this.stopBrowserRecording();
  735. }
  736. },
  737. // 添加新方法:停止小程序录制
  738. stopMiniProgramRecording() {
  739. if (!this.cameraContext) {
  740. console.error("相机上下文不存在");
  741. this.proceedToNextQuestion();
  742. return;
  743. }
  744. this.cameraContext.stopRecord({
  745. success: (res) => {
  746. console.log("小程序录像停止成功:", res);
  747. const tempFilePath = res.tempVideoPath;
  748. this.uploadRecordedVideo(tempFilePath);
  749. },
  750. fail: (err) => {
  751. console.error("小程序录像停止失败:", err);
  752. common_vendor.index.showToast({
  753. title: "录制失败",
  754. icon: "none"
  755. });
  756. this.proceedToNextQuestion();
  757. }
  758. });
  759. },
  760. // 添加新方法:停止浏览器录制
  761. stopBrowserRecording() {
  762. if (this.mediaRecorder && this.mediaRecorder.state !== "inactive") {
  763. this.mediaRecorder.stop();
  764. console.log("浏览器录制停止成功");
  765. } else {
  766. console.error("MediaRecorder不存在或已经停止");
  767. this.proceedToNextQuestion();
  768. }
  769. },
  770. // 修改上传录制的视频方法
  771. uploadRecordedVideo(fileOrPath) {
  772. console.log("准备上传视频:", typeof fileOrPath === "string" ? fileOrPath : fileOrPath.name);
  773. common_vendor.index.showLoading({
  774. title: "正在上传...",
  775. mask: true
  776. });
  777. const userInfo = common_vendor.index.getStorageSync("userInfo");
  778. const openid = userInfo ? JSON.parse(userInfo).openid || "" : "";
  779. const tenant_id = common_vendor.index.getStorageSync("tenant_id") || "1";
  780. let questionId;
  781. switch (this.currentVideoIndex) {
  782. case 1:
  783. questionId = 10;
  784. break;
  785. case 2:
  786. questionId = 11;
  787. break;
  788. case 3:
  789. questionId = 12;
  790. break;
  791. case 4:
  792. questionId = 13;
  793. break;
  794. default:
  795. questionId = 10;
  796. }
  797. if (typeof fileOrPath !== "string") {
  798. const formData = new FormData();
  799. formData.append("file", fileOrPath);
  800. formData.append("openid", openid);
  801. formData.append("tenant_id", tenant_id);
  802. formData.append("application_id", 1);
  803. formData.append("question_id", questionId);
  804. formData.append("video_duration", 0);
  805. formData.append("has_audio", "true");
  806. const xhr = new XMLHttpRequest();
  807. xhr.open("POST", "http://192.168.66.187:8083/api/system/upload/", true);
  808. xhr.onload = () => {
  809. common_vendor.index.hideLoading();
  810. if (xhr.status === 200) {
  811. try {
  812. const res = JSON.parse(xhr.responseText);
  813. console.log("上传响应:", res);
  814. if (res.code === 2e3) {
  815. const videoUrl = res.data.url || res.data.photoUrl || "";
  816. if (videoUrl) {
  817. this.submitVideoToInterview(videoUrl);
  818. } else {
  819. common_vendor.index.showToast({
  820. title: "视频URL获取失败",
  821. icon: "none"
  822. });
  823. }
  824. } else {
  825. common_vendor.index.showToast({
  826. title: res.msg || "上传失败,请重试",
  827. icon: "none"
  828. });
  829. }
  830. } catch (e) {
  831. console.error("解析响应失败:", e);
  832. common_vendor.index.showToast({
  833. title: "解析响应失败",
  834. icon: "none"
  835. });
  836. }
  837. } else {
  838. common_vendor.index.showToast({
  839. title: "上传失败,HTTP状态: " + xhr.status,
  840. icon: "none"
  841. });
  842. }
  843. };
  844. xhr.onerror = () => {
  845. common_vendor.index.hideLoading();
  846. console.error("上传网络错误");
  847. common_vendor.index.showToast({
  848. title: "网络错误,请重试",
  849. icon: "none"
  850. });
  851. };
  852. xhr.upload.onprogress = (event) => {
  853. if (event.lengthComputable) {
  854. const percentComplete = Math.round(event.loaded / event.total * 100);
  855. console.log("上传进度:", percentComplete + "%");
  856. }
  857. };
  858. xhr.send(formData);
  859. return;
  860. }
  861. common_vendor.index.uploadFile({
  862. url: "http://192.168.66.187:8083/api/system/upload/",
  863. filePath: fileOrPath,
  864. name: "file",
  865. formData: {
  866. openid,
  867. tenant_id,
  868. application_id: 1,
  869. question_id: questionId,
  870. video_duration: 0,
  871. has_audio: "true"
  872. // 明确标记视频包含音频
  873. },
  874. success: (uploadRes) => {
  875. try {
  876. const res = JSON.parse(uploadRes.data);
  877. console.log("上传响应:", res);
  878. if (res.code === 2e3) {
  879. const videoUrl = res.data.permanent_link || res.data.url || "";
  880. if (videoUrl) {
  881. this.submitVideoToInterview(videoUrl);
  882. } else {
  883. common_vendor.index.showToast({
  884. title: "视频URL获取失败",
  885. icon: "none"
  886. });
  887. }
  888. } else {
  889. common_vendor.index.showToast({
  890. title: res.msg || "上传失败,请重试",
  891. icon: "none"
  892. });
  893. }
  894. } catch (e) {
  895. console.error("解析响应失败:", e);
  896. common_vendor.index.showToast({
  897. title: "解析响应失败",
  898. icon: "none"
  899. });
  900. }
  901. },
  902. fail: (err) => {
  903. console.error("上传失败:", err);
  904. common_vendor.index.showToast({
  905. title: "上传失败,请重试",
  906. icon: "none"
  907. });
  908. },
  909. complete: () => {
  910. common_vendor.index.hideLoading();
  911. }
  912. });
  913. },
  914. // 修改 submitVideoToInterview 方法
  915. submitVideoToInterview(videoUrl) {
  916. console.log("提交视频URL到面试接口:", videoUrl);
  917. let questionId;
  918. switch (this.currentVideoIndex) {
  919. case 1:
  920. questionId = 10;
  921. break;
  922. case 2:
  923. questionId = 11;
  924. break;
  925. case 3:
  926. questionId = 12;
  927. break;
  928. case 4:
  929. questionId = 13;
  930. break;
  931. default:
  932. questionId = 10;
  933. }
  934. const requestData = {
  935. application_id: 1,
  936. question_id: questionId,
  937. video_url: videoUrl,
  938. video_duration: 0,
  939. tenant_id: common_vendor.index.getStorageSync("tenant_id") || "1"
  940. };
  941. common_vendor.index.request({
  942. url: "http://192.168.66.187:8083/api/job/upload_question_video",
  943. method: "POST",
  944. data: requestData,
  945. header: {
  946. "content-type": "application/json"
  947. },
  948. success: (res) => {
  949. console.log("面试接口提交成功:", res);
  950. common_vendor.index.hideLoading();
  951. if (res.data.code === 0 || res.data.code === 2e3) {
  952. common_vendor.index.showToast({
  953. title: "回答已提交",
  954. icon: "success"
  955. });
  956. this.lastUploadedVideoUrl = videoUrl;
  957. setTimeout(() => {
  958. if (this.currentVideoIndex === 4) {
  959. common_vendor.index.navigateTo({
  960. url: "/pages/camera/camera"
  961. });
  962. } else {
  963. this.proceedToNextQuestion();
  964. }
  965. }, 1500);
  966. } else {
  967. common_vendor.index.showToast({
  968. title: res.data.msg || "提交失败,请重试",
  969. icon: "none"
  970. });
  971. }
  972. },
  973. fail: (err) => {
  974. console.error("面试接口提交失败:", err);
  975. common_vendor.index.hideLoading();
  976. common_vendor.index.showToast({
  977. title: "网络错误,请重试",
  978. icon: "none"
  979. });
  980. }
  981. });
  982. },
  983. // 修改 proceedToNextQuestion 方法
  984. proceedToNextQuestion() {
  985. if (this.currentVideoIndex === 4) {
  986. common_vendor.index.navigateTo({
  987. url: "/pages/camera/camera"
  988. });
  989. return;
  990. }
  991. this.currentVideoIndex++;
  992. if (this.currentVideoIndex < this.videoList.length) {
  993. this.videoUrl = this.videoList[this.currentVideoIndex];
  994. this.videoPlaying = true;
  995. this.currentSubtitle = "";
  996. this.$nextTick(() => {
  997. const videoContext = common_vendor.index.createVideoContext("myVideo", this);
  998. if (videoContext) {
  999. videoContext.play();
  1000. }
  1001. });
  1002. } else {
  1003. common_vendor.index.showToast({
  1004. title: "面试完成",
  1005. icon: "success",
  1006. duration: 2e3
  1007. });
  1008. setTimeout(() => {
  1009. common_vendor.index.navigateTo({
  1010. url: "/pages/interview-result/interview-result"
  1011. });
  1012. }, 2e3);
  1013. }
  1014. },
  1015. // 修改 handleAnswerButtonClick 方法
  1016. handleAnswerButtonClick() {
  1017. this.showAnswerButton = false;
  1018. this.proceedToNextQuestion();
  1019. },
  1020. // 处理相机错误
  1021. handleCameraError(e) {
  1022. console.error("相机错误:", e);
  1023. common_vendor.index.showToast({
  1024. title: "相机初始化失败,请检查权限设置",
  1025. icon: "none"
  1026. });
  1027. this.tryFallbackOptions();
  1028. },
  1029. // 添加新方法:尝试备用选项
  1030. tryFallbackOptions() {
  1031. const systemInfo = common_vendor.index.getSystemInfoSync();
  1032. if (systemInfo.uniPlatform === "mp-weixin" || systemInfo.uniPlatform === "mp-alipay") {
  1033. this.useMiniProgramCamera();
  1034. } else {
  1035. this.showStaticCameraPlaceholder();
  1036. }
  1037. },
  1038. // 添加新方法:使用小程序相机API
  1039. useMiniProgramCamera() {
  1040. console.log("尝试使用小程序相机组件");
  1041. this.useMiniProgramCameraComponent = true;
  1042. },
  1043. // 添加新方法:显示静态图像
  1044. showStaticCameraPlaceholder() {
  1045. console.log("显示静态摄像头占位图");
  1046. const img = document.createElement("img");
  1047. img.src = "/static/images/camera-placeholder.png";
  1048. img.className = "static-camera-image";
  1049. img.style.width = "100%";
  1050. img.style.height = "100%";
  1051. img.style.objectFit = "cover";
  1052. const container = this.$refs.userCameraVideo.parentNode;
  1053. container.appendChild(img);
  1054. },
  1055. // 处理视频时间更新事件
  1056. handleTimeUpdate(e) {
  1057. const currentTime = e.target.currentTime;
  1058. let currentSubtitles;
  1059. if (this.currentVideoIndex === 0) {
  1060. currentSubtitles = this.subtitles;
  1061. } else if (this.currentVideoIndex === 1) {
  1062. currentSubtitles = this.secondVideoSubtitles;
  1063. } else if (this.currentVideoIndex === 2) {
  1064. currentSubtitles = this.thirdVideoSubtitles;
  1065. } else if (this.currentVideoIndex === 3) {
  1066. currentSubtitles = this.fourthVideoSubtitles;
  1067. } else if (this.currentVideoIndex === 4) {
  1068. currentSubtitles = this.fifthVideoSubtitles;
  1069. } else if (this.currentVideoIndex === 5) {
  1070. currentSubtitles = this.sixthVideoSubtitles;
  1071. } else {
  1072. currentSubtitles = [];
  1073. }
  1074. const subtitle = currentSubtitles.find(
  1075. (sub) => currentTime >= sub.startTime && currentTime < sub.endTime
  1076. );
  1077. this.currentSubtitle = subtitle ? subtitle.text : "";
  1078. },
  1079. // Add a new method to handle the "Start Recording" button click
  1080. handleStartRecordingClick() {
  1081. this.showStartRecordingButton = false;
  1082. this.startRecordingAnswer();
  1083. },
  1084. // 修改 checkAudioPermission 方法,确保在录制前获取音频权限
  1085. checkAudioPermission() {
  1086. const systemInfo = common_vendor.index.getSystemInfoSync();
  1087. const isMiniProgram = systemInfo.uniPlatform && systemInfo.uniPlatform.startsWith("mp-");
  1088. if (isMiniProgram) {
  1089. common_vendor.index.getSetting({
  1090. success: (res) => {
  1091. if (!res.authSetting["scope.record"]) {
  1092. common_vendor.index.authorize({
  1093. scope: "scope.record",
  1094. success: () => {
  1095. console.log("录音权限已获取");
  1096. },
  1097. fail: (err) => {
  1098. console.error("录音权限获取失败:", err);
  1099. this.showPermissionDialog("录音");
  1100. }
  1101. });
  1102. }
  1103. if (!res.authSetting["scope.camera"]) {
  1104. common_vendor.index.authorize({
  1105. scope: "scope.camera",
  1106. success: () => {
  1107. console.log("相机权限已获取");
  1108. },
  1109. fail: (err) => {
  1110. console.error("相机权限获取失败:", err);
  1111. this.showPermissionDialog("相机");
  1112. }
  1113. });
  1114. }
  1115. }
  1116. });
  1117. }
  1118. },
  1119. // 添加新方法:测试音频输入
  1120. testAudioInput() {
  1121. if (!this.cameraStream) {
  1122. console.warn("没有可用的媒体流,无法测试音频");
  1123. return;
  1124. }
  1125. const audioTracks = this.cameraStream.getAudioTracks();
  1126. if (audioTracks.length === 0) {
  1127. console.warn("没有检测到音频轨道,尝试重新获取");
  1128. this.tryGetAudioOnly();
  1129. return;
  1130. }
  1131. console.log("音频轨道信息:", audioTracks[0].getSettings());
  1132. try {
  1133. const AudioContext = window.AudioContext || window.webkitAudioContext;
  1134. if (!AudioContext) {
  1135. console.warn("浏览器不支持AudioContext");
  1136. return;
  1137. }
  1138. const audioContext = new AudioContext();
  1139. const analyser = audioContext.createAnalyser();
  1140. const microphone = audioContext.createMediaStreamSource(this.cameraStream);
  1141. microphone.connect(analyser);
  1142. analyser.fftSize = 256;
  1143. const bufferLength = analyser.frequencyBinCount;
  1144. const dataArray = new Uint8Array(bufferLength);
  1145. let silenceCounter = 0;
  1146. const checkAudio = () => {
  1147. if (this.isRecording)
  1148. return;
  1149. analyser.getByteFrequencyData(dataArray);
  1150. let sum = 0;
  1151. for (let i = 0; i < bufferLength; i++) {
  1152. sum += dataArray[i];
  1153. }
  1154. const average = sum / bufferLength;
  1155. if (average > 10) {
  1156. console.log("检测到音频输入,音量:", average);
  1157. silenceCounter = 0;
  1158. } else {
  1159. silenceCounter++;
  1160. if (silenceCounter > 10) {
  1161. console.warn("持续检测不到音频输入,可能麦克风未正常工作");
  1162. silenceCounter = 0;
  1163. }
  1164. }
  1165. requestAnimationFrame(checkAudio);
  1166. };
  1167. checkAudio();
  1168. } catch (e) {
  1169. console.error("音频测试失败:", e);
  1170. }
  1171. },
  1172. // 添加新方法:尝试单独获取音频
  1173. tryGetAudioOnly() {
  1174. navigator.mediaDevices.getUserMedia({ audio: true }).then((audioStream) => {
  1175. if (this.cameraStream) {
  1176. const videoTrack = this.cameraStream.getVideoTracks()[0];
  1177. const audioTrack = audioStream.getAudioTracks()[0];
  1178. const combinedStream = new MediaStream();
  1179. if (videoTrack)
  1180. combinedStream.addTrack(videoTrack);
  1181. if (audioTrack)
  1182. combinedStream.addTrack(audioTrack);
  1183. this.cameraStream = combinedStream;
  1184. const videoElement = this.$refs.userCameraVideo;
  1185. if (videoElement) {
  1186. videoElement.srcObject = combinedStream;
  1187. videoElement.muted = true;
  1188. }
  1189. console.log("成功合并音频和视频轨道");
  1190. } else {
  1191. console.warn("没有视频流可合并");
  1192. }
  1193. }).catch((err) => {
  1194. console.error("单独获取音频失败:", err);
  1195. });
  1196. },
  1197. // 添加新方法:显示权限对话框
  1198. showPermissionDialog(permissionType) {
  1199. common_vendor.index.showModal({
  1200. title: "需要权限",
  1201. content: `请允许使用${permissionType}权限,否则可能影响面试功能`,
  1202. confirmText: "去设置",
  1203. success: (res) => {
  1204. if (res.confirm) {
  1205. common_vendor.index.openSetting({
  1206. success: (settingRes) => {
  1207. console.log("设置页面打开成功", settingRes);
  1208. }
  1209. });
  1210. }
  1211. }
  1212. });
  1213. }
  1214. }
  1215. };
  1216. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  1217. return common_vendor.e({
  1218. a: $data.videoUrl,
  1219. b: common_vendor.o((...args) => $options.handleVideoError && $options.handleVideoError(...args)),
  1220. c: common_vendor.o((...args) => $options.handleVideoEnded && $options.handleVideoEnded(...args)),
  1221. d: common_vendor.o((...args) => $options.handleTimeUpdate && $options.handleTimeUpdate(...args)),
  1222. e: $data.currentSubtitle
  1223. }, $data.currentSubtitle ? {
  1224. f: common_vendor.t($data.currentSubtitle)
  1225. } : {}, {
  1226. g: $data.showAnswerButton
  1227. }, $data.showAnswerButton ? {
  1228. h: common_vendor.o((...args) => $options.handleAnswerButtonClick && $options.handleAnswerButtonClick(...args))
  1229. } : {}, {
  1230. i: $data.useMiniProgramCameraComponent
  1231. }, $data.useMiniProgramCameraComponent ? {
  1232. j: common_vendor.o((...args) => $options.handleCameraError && $options.handleCameraError(...args))
  1233. } : {}, {
  1234. k: $data.loading
  1235. }, $data.loading ? {} : {}, {
  1236. l: $data.showDebugInfo
  1237. }, $data.showDebugInfo ? common_vendor.e({
  1238. m: $data.assistantResponse
  1239. }, $data.assistantResponse ? {
  1240. n: common_vendor.t($data.assistantResponse)
  1241. } : {}, {
  1242. o: $data.audioTranscript
  1243. }, $data.audioTranscript ? {
  1244. p: common_vendor.t($data.audioTranscript)
  1245. } : {}, {
  1246. q: common_vendor.f($data.processedResponses, (item, index, i0) => {
  1247. return common_vendor.e({
  1248. a: item.role
  1249. }, item.role ? {
  1250. b: common_vendor.t(item.role)
  1251. } : {}, {
  1252. c: item.transcript
  1253. }, item.transcript ? {
  1254. d: common_vendor.t(item.transcript)
  1255. } : {}, {
  1256. e: index
  1257. });
  1258. })
  1259. }) : {}, {
  1260. r: $data.showStopRecordingButton
  1261. }, $data.showStopRecordingButton ? {
  1262. s: common_vendor.o((...args) => $options.stopRecordingAnswer && $options.stopRecordingAnswer(...args))
  1263. } : {}, {
  1264. t: $data.isRecording
  1265. }, $data.isRecording ? {} : {}, {
  1266. v: $data.showStartRecordingButton
  1267. }, $data.showStartRecordingButton ? {
  1268. w: common_vendor.o((...args) => $options.handleStartRecordingClick && $options.handleStartRecordingClick(...args))
  1269. } : {});
  1270. }
  1271. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-464e78c6"]]);
  1272. wx.createPage(MiniProgramPage);