Trying to load local device files on an android device.
successfully loaded the .png file, having an issue in loading .mp3.
stopRecording = () => {
console.log("clikced");
let clip = this.node.getComponent(AudioSource).clip;
console.log(clip);
this.stopLabel.string = "Recording stopped"
//native.reflection.callStaticMethod("com/cocos/game/AppActivity", "stopRecording", "(Ljava/lang/String;)V", "stop");
var result = native.reflection.callStaticMethod("com/cocos/game/AppActivity", "stopRecording", "(Ljava/lang/String;)Ljava/lang/String;", "stop");
console.log("Inside StopRecording", result);
if (result) {
console.log("INSIDE IF CONDITION");
let absolutePath = `${result}/1.jpg`
assetManager.loadRemote<ImageAsset>(absolutePath, (err, imageAsset) => {
if (err) {
console.log("ERROR");
console.log(JSON.stringify(err));
return;
}
console.log("NO ERROR");
const spriteFrame = new SpriteFrame();
const texture = new Texture2D();
texture.image = imageAsset;
spriteFrame.texture = texture;
console.log("SPRITE", JSON.stringify(spriteFrame));
this.btnSprite.spriteFrame = spriteFrame;
});
let absolutePath2 = `${result}/music1.mp3`
assetManager.loadRemote<AudioClip>(absolutePath2, {audioLoadMode:3},(err, audioClip) => {
console.log("PATH", absolutePath2);
if (err) {
console.log("ERROR");
console.log(JSON.stringify(err))
return;
}
console.log("CLIP", audioClip);
// console.log("NODE", this.node);
});
//{audioLoadMode:3},
let absolutePath3 = `${result}/music2.wav`
assetManager.loadRemote<AudioClip>(absolutePath3, {audioLoadMode:3}, (err, audioClip) => {
console.log("PATH Check 4", absolutePath3);
if (err) {
console.log("ERROR");
console.log(JSON.stringify(err))
return;
}
console.log("CLIP", audioClip);
// console.log("NODE", this.node);
});
}
}