We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
this is the error:
my code:
<template> <Page class="page"> <ActionBar class="action-bar"> <Label class="action-bar-title" text="Home"></Label> </ActionBar> <StackLayout backgroundColor="#3c495e"> <Label>{{ recording ? '录音中' : '' }}</Label> <button @tap="start">开始</button> <button @tap="stop">关闭</button> <button @tap="play">播放</button> </StackLayout> </Page> </template> <script> import * as Audio from 'nativescript-audio' import { File, knownFolders } from 'tns-core-modules/file-system' export default { data () { return { player: new Audio.TNSPlayer(), recorder: new Audio.TNSRecorder(), recording: false, audioPath: `${knownFolders.currentApp().getFolder('audio').path}/record.mp3` } }, mounted() { this.recorder.debug = true }, methods: { start () { console.log('aysnc start >>>>>>>>>>>>>>>>>> start') const options = { filename: this.audioPath, metering: true, infoCallback: infoObject => { console.log('record-infoCallBack', JSON.stringify(infoObject)); }, errorCallback: errorObject => { console.log('record-errorCallback', JSON.stringify(errorObject)); } } this.recorder.start(options).catch(ex => { console.log(ex) }) this.recording = true console.log('aysnc start >>>>>>>>>>>>>>>>>> end') }, stop () { console.log('stop>>>>>>>>>>>>>>>>>>') console.log(this.audioPath) this.recorder.stop().catch(ex => { console.log(ex) }) this.recording = false }, play () { console.log('play>>>>>>>>>>>>>>>>>>') const options = { audioFile: this.audioPath, loop: false, completeCallback: () => { alert('Audio file complete.') }, errorCallback: errorObject => { console.log(JSON.stringify(errorObject)) }, infoCallback: infoObject => { console.log(JSON.stringify(infoObject)) } } this.player.playFromFile(options).catch(err => { console.log('error playFromFile', err) }) } } } </script> <style scoped lang="scss"> // Start custom common variables @import "../app-variables"; // End custom common variables // Custom styles .fa { color: $accent-dark; } .info { font-size: 20; } </style>
How to set encode and format? Any examples of parameters? thank you :)
The text was updated successfully, but these errors were encountered:
are you using vue.js? should it be something like this for your data and mounted?
data
mounted
export default { data: function() { return { player: new Audio.TNSPlayer(), recorder: new Audio.TNSRecorder(), recording: false, audioPath: `${knownFolders.currentApp().getFolder('audio').path}/record.mp3` } }, mounted: function() { this.recorder.debug = true }, ... }
Sorry, something went wrong.
Hi @yoking-shi I have read (I don't remember where xD), you must set manually the value you want to use, you can see all value on this page: https://developer.android.com/reference/android/media/MediaRecorder.AudioEncoder for example 3 for AAC encoding: https://developer.android.com/reference/android/media/MediaRecorder.AudioEncoder.html#AAC
bye 👍
No branches or pull requests
this is the error:
my code:
How to set encode and format? Any examples of parameters?
thank you :)
The text was updated successfully, but these errors were encountered: