Commit c31c6268 authored by 李帅's avatar 李帅

优化

parent 85d52699
/* /*
* @Author: ls * @Author: ls
* @Date: 2022-05-15 18:22:18 * @Date: 2022-05-15 18:22:18
* @LastEditTime: 2022-05-22 17:37:44 * @LastEditTime: 2022-05-22 19:21:58
* @LastEditors: ls * @LastEditors: ls
* @Description: * @Description:
* @FilePath: \ls_gramophone\assets\ls_gramophone\scene\ls_gramophone.ts * @FilePath: \ls_gramophone\assets\ls_gramophone\scene\ls_gramophone.ts
*/ */
import Item from '../script/Item'; import Item from '../script/Item';
import { MyCocosSceneComponent } from '../script/MyCocosSceneComponent'; import { MyCocosSceneComponent } from '../script/MyCocosSceneComponent';
import { onHomeworkFinish } from '../script/util';
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
...@@ -179,7 +180,10 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -179,7 +180,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
record_stop.active = true; record_stop.active = true;
this._recording = true; this._recording = true;
// window['Recorder'].start();
if (window['courseware']) {
window['courseware'].startRecord(1);
}
}); });
record_stop.on('click', () => { record_stop.on('click', () => {
this.playLocalAudio('btn'); this.playLocalAudio('btn');
...@@ -189,20 +193,43 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -189,20 +193,43 @@ export default class SceneComponent extends MyCocosSceneComponent {
record_stop.active = false; record_stop.active = false;
this._recording = false; this._recording = false;
// window['Recorder'].stop();
let idx = -1; // 获取当前录制下标
for (let index = 0; index < this.content.childrenCount; index++) { for (let index = 0; index < this.content.childrenCount; index++) {
const element = this.content.children[index]; const element = this.content.children[index];
// 正在录制中 // 正在录制中
if (element.getComponent(Item).getRecording()) { if (element.getComponent(Item).getRecording()) {
element.getComponent(Item).recorded(); idx = index;
break;
}
}
if (window['courseware']) {
window['courseware'].stopRecord((res) => {
this.log('--------录音返回结果 stopRecord ------------');
this.log(res);
this.log(`录音的音频URL是${JSON.parse(res).audioUrl}`);
if (idx !== -1) {
this.content.children[idx].getComponent(Item).recorded();
}
this._records[index] = '';
// this._records[index] = window['Recorder'].getBlob();
this.resetRecord(); this.resetRecord();
return;
if (res && JSON.parse(res).audioUrl) {
if (idx !== -1) {
this._records[idx] = JSON.parse(res).audioUrl;
onHomeworkFinish(res);
}
}
});
} else {
if (idx !== -1) {
this.content.children[idx].getComponent(Item).recorded();
} }
this.resetRecord();
} }
}); });
} }
......
This diff is collapsed.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 83, "height": 83,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"录音": { "icon_record": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "5b67343e-8927-4b5f-9653-3aa36a67c245", "uuid": "5b67343e-8927-4b5f-9653-3aa36a67c245",
"rawTextureUuid": "fb73c820-7ca8-4450-8bb6-79d231e5733a", "rawTextureUuid": "fb73c820-7ca8-4450-8bb6-79d231e5733a",
......
{
"ver": "1.1.2",
"uuid": "b9f5800f-8915-4e6e-a914-158e979d6a84",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "53603c71-3077-4b5d-bb59-d6e15e1d3719",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1334,
"height": 750,
"platformSettings": {},
"subMetas": {
"1-点击start开始": {
"ver": "1.0.4",
"uuid": "e10bc390-de9f-45ea-9d83-7e7e4d9421a6",
"rawTextureUuid": "53603c71-3077-4b5d-bb59-d6e15e1d3719",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1334,
"height": 750,
"rawWidth": 1334,
"rawHeight": 750,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "836ecbc5-201b-416e-8eed-5aa0fded9c34",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1334,
"height": 750,
"platformSettings": {},
"subMetas": {
"2-点击左下播放按钮开始播放整段音频内容,再次点击停止播放": {
"ver": "1.0.4",
"uuid": "c1da4ac0-1475-444e-a392-2448afc2ce66",
"rawTextureUuid": "836ecbc5-201b-416e-8eed-5aa0fded9c34",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1334,
"height": 750,
"rawWidth": 1334,
"rawHeight": 750,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "ef0f1593-1e56-4238-93fe-dda41a31dfe6",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1334,
"height": 750,
"platformSettings": {},
"subMetas": {
"3-点击句子播放句子的音频,同时字体颜色变成橘色,句子开头出现播放提示效果": {
"ver": "1.0.4",
"uuid": "e83c8fc3-af7a-43bb-87b3-255ba6ce4724",
"rawTextureUuid": "ef0f1593-1e56-4238-93fe-dda41a31dfe6",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1334,
"height": 750,
"rawWidth": 1334,
"rawHeight": 750,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "e6f3ffd3-f5dd-4a53-a71e-e92e85f3519e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1334,
"height": 750,
"platformSettings": {},
"subMetas": {
"4-点击句子后面的录音按钮,弹出录音界面,点击start开始录音": {
"ver": "1.0.4",
"uuid": "23555c3e-a82e-4806-a8dd-16e5a0121412",
"rawTextureUuid": "e6f3ffd3-f5dd-4a53-a71e-e92e85f3519e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1334,
"height": 750,
"rawWidth": 1334,
"rawHeight": 750,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "40eca57e-ea7e-4654-8ea4-828ae552021f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1334,
"height": 750,
"platformSettings": {},
"subMetas": {
"5-录音结束当前句子后面出现我的录音,点击播放": {
"ver": "1.0.4",
"uuid": "759cf454-75da-48f2-8032-143bec729c24",
"rawTextureUuid": "40eca57e-ea7e-4654-8ea4-828ae552021f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1334,
"height": 750,
"rawWidth": 1334,
"rawHeight": 750,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "78ac9a51-bbd6-40cb-be04-5ed006163563",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment