录音amr格式播放

public function ajax_get_show_recording_form(){
    app('think\\Route')->setConfig(['default_ajax_return' => 'html']);
    $fuid = input('post.fuid');
    $data_res =  Db::table('zf_app_user_recording')->alias(' B')
        ->field("B.*")
        ->where('B.id','=',$fuid)
        ->find();
    $ur =  str_replace("/home/htdocs/","https://",$data_res['filepath']);
    $url2= @file_get_contents($ur);
    $url=base64_encode($url2);
    $this->assign('fuid',$fuid);
    $this->assign('url',$url);
    $this->fetch = true;
}

view:

< style type=“text/css”>
.playContainer { position: relative; float: left; background: rgba(0, 0, 0, 0.8); padding: 10px;margin-top: 20px; width: 40%;float: left }
.playContainer li { position: relative; float: left; border: 25px solid #404040; color: #404040; height: 0; width:0; -webkit-border-radius: 100%; -moz-border-radius: 100%; -o-border-radius: 100%; border-radius: 100%; margin: 0 20px; }
.playContainer a { border-style: solid; text-indent: -9999px; position: absolute; top: -8px; left: -3px; }

.playBtn a { border-color: transparent transparent transparent #fff; border-width: 8px 0 8px 12px;  width: 0; height: 0; }
.pauseBtn a { border-color: transparent white;  border-width: 0 6px; height: 15px; width: 6px; left: -9px; }
.stopBtn a { border: 7px solid #fff; height: 0; width: 0; left: -7px; top: -7px;}
.forwardBtn a { border-left-width: 8px; left: 1px; }
.forwardBtn a:first-child { margin-left: -7px;  }

.rewindBtn a { border-width: 8px 8px 8px 0; border-color: transparent #fff transparent transparent; width: 0; height: 0; }
.rewindBtn a:first-child { margin-left: -7px; }

.ejectBtn a.arrow { border-width: 0 8px 8px 8px; border-color: transparent transparent #fff transparent; top:-26px; left:-8px; }
.ejectBtn a.dash { border-width: 0 0 4px; border-color: transparent transparent #fff; height: 0; width:16px; left: -8px; top: 4px; }

< /style>

< script src="/files/simple-lide/js/voice-2.0.js">< /script>
< div style=“height: 70px; width:30%;float: left;margin-top: 20px;”>< /div>

< div class=“playContainer”>
< li class=“playBtn” id=“playId”>
< a href="#" title=“start” >Start< /a>
< /li>
< li class=“stopBtn” id=“stopId”>
< a href="#" title=“pause”>Pause< /a>
< /li>
< /div>

< div style=“height: 70px; width:30%;float: left;margin-top: 20px;”>< /div>

< script>
RongIMLib.RongIMVoice.init();
document.getElementById(“playId”).onclick = function(){
var c_name = document.getElementById(‘playId’) .getAttribute(‘class’);
if(c_name == “playBtn”) {
var changeLib = document.getElementById(‘playId’);
changeLib.classList.remove(“playBtn”);
changeLib.classList.add(“pauseBtn”);
RongIMLib.RongIMVoice.play("{$url}");
}
else if(c_name == “pauseBtn”){
var div1 = document.getElementById(‘playId’);
div1.classList.remove(“pauseBtn”);
div1.classList.add(“playBtn”);
RongIMLib.RongIMVoice.stop();
}
};
document.getElementById(“stopId”).onclick = function(){
RongIMLib.RongIMVoice.onprogress();
};
< /script>

你可能感兴趣的:(PHP)