我想在BlackBerry 10 OS的通话时间内录制通话语音。为此,我使用了Telephony Phone和Call State Listener。我开始发现呼叫状态"已连接"呼叫时停止"断开连接"。
但是在开始时记录器每次只记录160Byte的数据。 并且在停止时刻录音机显示"已经毫无准备"。
为此我使用recorder.prepare()但它仍然不适合我。请建议并帮助我。这是代码
void ApplicationHeadless::onCallUpdated(const Call &call)
{
QMetaObject MetaCallTypeObject = CallType::staticMetaObject;
QMetaEnum CallTypeEnum = MetaCallTypeObject.enumerator(
MetaCallTypeObject.indexOfEnumerator("Type"));
QMetaObject MetaCallStateObject = CallState::staticMetaObject;
QMetaEnum CallStateEnum = MetaCallStateObject.enumerator(
MetaCallStateObject.indexOfEnumerator("Type"));
CallType::Type CurrentCallType = call.callType();
CallState::Type CurrentCallState = call.callState();
QString conn = "Connected";
QString dcon = "Disconnected";
QDateTime now = QDateTime::currentDateTime();
bb::multimedia::AudioRecorder recorder;
if (conn.compare(CallStateEnum.valueToKey(CurrentCallState)) == 0) {
recorder.setOutputUrl(QUrl("/tmp/" + now.toString() + ".m4a"));
recorder.setOutputUrl(QUrl("file://" + QDir::currentPath() + "/data/recording121.m4a"));
recorder.record();
}
if (dcon.compare(CallStateEnum.valueToKey(CurrentCallState)) == 0) {
recorder.reset();
}
}
提前致谢..