From 16e4b7ce2745bcd7276a855abc5ac289db8cd15e Mon Sep 17 00:00:00 2001 From: chrisgarrity Date: Mon, 17 Jul 2017 11:25:59 -0400 Subject: [PATCH] Limit size of sounds We know that projects with lots of (large) sounds tend to crash ScratchJr. Hopefully reducing the size of the sounds will help to reduce the number of crashes. --- ios/ScratchJr/src/RecordSound.m | 4 ++-- src/editor/ui/Record.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ios/ScratchJr/src/RecordSound.m b/ios/ScratchJr/src/RecordSound.m index 450b448..4a1d4b8 100644 --- a/ios/ScratchJr/src/RecordSound.m +++ b/ios/ScratchJr/src/RecordSound.m @@ -61,9 +61,9 @@ NSString *canRecord; NSError *err; NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: kAudioFormatLinearPCM], AVFormatIDKey, - [NSNumber numberWithFloat: 22050.0], AVSampleRateKey, + [NSNumber numberWithFloat: 16000.0], AVSampleRateKey, [NSNumber numberWithInt: 1], AVNumberOfChannelsKey, - [NSNumber numberWithInt: 16], AVLinearPCMBitDepthKey, + [NSNumber numberWithInt: 8], AVLinearPCMBitDepthKey, nil]; recorder = [[ AVAudioRecorder alloc] initWithURL:url settings:settings error:&err]; if (err) { diff --git a/src/editor/ui/Record.js b/src/editor/ui/Record.js index af6ec75..c02cd5b 100644 --- a/src/editor/ui/Record.js +++ b/src/editor/ui/Record.js @@ -173,7 +173,7 @@ export default class Record { if (isRecording) { Record.stopRecording(); } - }, 60000); + }, 30000); } }