无法从callfire api播放.wav文件

时间:2013-02-12 11:35:35

标签: android cordova sencha-touch-2

我们在Android应用程序中使用callfire API(使用sencha和phonegap构建混合应用程序)。该应用程序的概念是在列表中显示录制的呼叫,单击列表中的任何呼叫,它将播放录制的音频文件(.wav格式)。现在的问题是我们无法在我们的应用程序中播放该文件。我们还试图直接在Android手机浏览器上播放该网址,但它也没有用。

以下是音频文件格式https://www.callfire.com/cloud/1/files/recording/dynamic/864c81f4a8e6a898042cb47251ca1c85/2012/8/6065312/cid_1319779221_1.wav

的网址之一

当我们将此音频文件放入我们的服务器并尝试将其应用于我们的应用程序时,它运行良好。

请告诉我们这背后的原因是什么?

我们正在使用Samsung Galexy Y和软件版本2.2进行测试。

2 个答案:

答案 0 :(得分:0)

您可以使用可用的HTML5音频测试here来检查设备的浏览器是否支持它,但听起来不是。

答案 1 :(得分:0)

您似乎正在引用较旧版本的CallFire API。这是一个新的接口,加上一个提供GetSoundData方法的新API。调用此方法返回原始MP3数据,您也可以请求WAV。

https://www.callfire.com/api-documentation/version/1.1/CallService/GetSoundData

该文档提供了一个PHP示例,但如果您使用另一种语言,则参数应该相同。

<?php
/**
 * You'll need your login/password pair when you create the SOAP client.
 * Don't use the fake login/password provided here; it's just for show and
 * won't work.
 */
$wsdl = "http://callfire.com/api/1.1/wsdl/callfire-service-http-soap12.wsdl";
$client = new SoapClient($wsdl, array(
    'soap_version' => SOAP_1_2,
    'login'        => 'YourLoginId',    
    'password'     => 'YourPassword'));
/**
 * GetSoundData. Get raw binary sound data (MP3 or WAV) for stored sound asset.
 */
$request = new stdclass();
$request->Id = 9; // long required  
$request->Format = 'MP3'; // SoundFormat   [WAV, MP3]
$response = $client->GetSoundData($request);
$byteCount = file_put_contents("my_returned_sound.mp3", $response);
echo "byteCount: " . $byteCount;
// Sample response:
// byteCount: 22749
?>
相关问题