开发者

Problems Recording with blackBerry.meda.microphone in BlackBerry WebWorks Application

开发者 https://www.devze.com 2023-04-12 07:57 出处:网络
I am developing a BB WebWorks application (targeting BlackBerry OS 6.0+) and I need to record audio using the device microphone.I\'ve thoroughly read the blackberry.media.microphone documentation but

I am developing a BB WebWorks application (targeting BlackBerry OS 6.0+) and I need to record audio using the device microphone. I've thoroughly read the blackberry.media.microphone documentation but its not clear WHERE I should be recording TO or where the application is ALLOWED to record to?

When I do try and record something to either

file://SDCard/

or

file://store/home/user/voicenotes/

for example the onError callback function is executed and I get the following...

ErroCode: "-1"

ErrorMessage: "This application is not allowed to access controlled network resources".

Here's my page...

<!DOCTYPE html> 
<html>
<head>
    <script type="text/javascript">

        function record() {         
            try {
                blackberry.media.microphone.record("file://SDCard/audiofile.amr", recordSuccess, recordError);
            } catch (e) {
                alert('Record, e:开发者_StackOverflow中文版' + e.message);
            }       
        }

        function recordSuccess(filePath) {
            alert("Recorded successfully! File: " + filePath);      
        }

        function recordError(errorCode, errorMessage) {
            alert('error code:' + errorCode + ' error message:' + errorMessage);
        }

    </script> 
</head> 
<body>
    <button id="record" onclick="record();">Record</button>  
</body>
</html>

and my config.xml...

<?xml version="1.0" encoding="utf-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="1.0.0" rim:header="RIM-Widget:rim/widget">

  <name>Test Microphone app</name>

  <content src="index.htm" />

  <action>access_shared</action>
  <permission>access_shared</permission>  

  <feature id="blackberry.app" />
  <feature id="blackberry.identity" />
  <feature id="blackberry.identity.phone" />
  <feature id="blackberry.io.dir" />
  <feature id="blackberry.io.file" />
  <feature id="blackberry.media.microphone" />
  <feature id="blackberry.system" />
  <feature id="blackberry.ui.dialog" />
  <feature id="blackberry.ui.menu" />
  <feature id="blackberry.utils" />

</widget>

Thanks in advance.


Try using ...

file:///SDCard/

or

file:///store/home/user/voicenotes/

NOTE the THREE slashes after "file:".

Also if you want to record to an application specific area then use something like...

local:///recordings/myrecording.amr
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号