如何播放存储中的音频

时间:2019-05-14 18:32:57

标签: laravel-5 audio local-storage

我想问问是否有任何方法可以在不创建Storage:链接的情况下从laravel 5.5中的存储播放wav音频:链接我以以下方式进行操作,这给我一个错误: 错误:     POST http://horafacil.localhost/admin/app/Helpers/WatsonTts.php 404(未找到)

路线:

Route::get('{audio}/get-audio',[
    'uses' => 'AlertaTelefonicaController@getAudio',
    'as' => 'admin.alertatelefono.getAudio'
]);

控制器:

 public function getAudio(Audio $audio)
{
    $fileContents = Storage::disk('local')->get("grabaciones/mensaje.wav");
    $response = Response::make($fileContents, 200);
    $response->header('Content-Type', "audio/wav");
    return $response;
}

查看:

<div id="reproductor" style="display: none">
                            <audio id="audio" type="audio/wav" controls>
                                    <source src="{{ route('admin.alertatelefono.getAudio', 'mensaje.wav')  }}" type="audio/wav">
                            </audio>
                    </div>

帮助请求。

0 个答案:

没有答案
相关问题