kopia lustrzana https://github.com/backface/turtlestitch
encode recorded sounds to base64
rodzic
b5e7eded95
commit
bea1d912cc
29
gui.js
29
gui.js
|
@ -71,11 +71,11 @@ fontHeight, hex_sha512, sb, CommentMorph, CommandBlockMorph, BooleanSlotMorph,
|
|||
BlockLabelPlaceHolderMorph, Audio, SpeechBubbleMorph, ScriptFocusMorph,
|
||||
XML_Element, WatcherMorph, BlockRemovalDialogMorph, saveAs, TableMorph,
|
||||
isSnapObject, isRetinaEnabled, disableRetinaSupport, enableRetinaSupport,
|
||||
isRetinaSupported, SliderMorph, Animation, BoxMorph*/
|
||||
isRetinaSupported, SliderMorph, Animation, BoxMorph, MediaRecorder*/
|
||||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.gui = '2018-January-25';
|
||||
modules.gui = '2018-February-01';
|
||||
|
||||
// Declarations
|
||||
|
||||
|
@ -2303,7 +2303,10 @@ IDE_Morph.prototype.recordNewSound = function () {
|
|||
soundRecorder = new SoundRecorderDialogMorph(
|
||||
function (sound) {
|
||||
if (sound) {
|
||||
myself.currentSprite.addSound(sound, myself.newSoundName('recording'));
|
||||
myself.currentSprite.addSound(
|
||||
sound,
|
||||
myself.newSoundName('recording')
|
||||
);
|
||||
myself.spriteBar.tabBar.tabTo('sounds');
|
||||
myself.hasChangedMedia = true;
|
||||
}
|
||||
|
@ -8826,15 +8829,17 @@ SoundRecorderDialogMorph.prototype.buildContents = function () {
|
|||
audioChunks.push(event.data);
|
||||
};
|
||||
myself.mediaRecorder.onstop = function (event) {
|
||||
myself.audioElement.src =
|
||||
window.URL.createObjectURL(
|
||||
new Blob(
|
||||
audioChunks,
|
||||
{'type': 'audio/ogg; codecs=opus'}
|
||||
)
|
||||
);
|
||||
myself.audioElement.load();
|
||||
audioChunks = [];
|
||||
var buffer = new Blob(audioChunks),
|
||||
reader = new window.FileReader();
|
||||
reader.readAsDataURL(buffer);
|
||||
reader.onloadend = function() {
|
||||
var base64 = reader.result;
|
||||
base64 = 'data:audio/ogg;base64,' +
|
||||
base64.split(',')[1];
|
||||
myself.audioElement.src = base64;
|
||||
myself.audioElement.load();
|
||||
audioChunks = [];
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3877,6 +3877,9 @@ Fixes:
|
|||
* new Sound Recorder, yay!! Thanks, Bernat!
|
||||
* Blocks: fixed a glitch in the error-bubble handling mechanism
|
||||
|
||||
180201
|
||||
------
|
||||
* GUI: encode recorded sounds to base64
|
||||
|
||||
|
||||
v4.1.1 New Features:
|
||||
|
|
Ładowanie…
Reference in New Issue