EduSoho本地視訊播放超時、無法播放、播放錯誤異常問題解決
理解:播放器會對本地視訊在資料丟失時進行資料獲取,每次消耗一次鑑權次數,次數為0是會出現播放出錯的問題。 解決:因此修改這個次數即可,這裡的程式碼沒有做細緻研究,可能存在錯誤
還是推薦大家使用雲視訊,如果需要阿里雲、騰訊雲視訊點播的可以聯絡我,流量摺合最低0.17每GB
檔案:
src/Biz/Player/Service/Impl/PlayerServiceImpl.php 函式:protected function makeToken(fileId, $context = array())
protected function makeToken($type, $fileId, $context = array()) { $fields = array( 'data' => array( 'id' => $fileId, ), 'times' => 10, // 修改這個引數即可,可以理解為鑑權次數 'duration' => 3600, 'userId' => $this->getCurrentUser()->getId(), ); if (isset($context['watchTimeLimit'])) { $fields['data']['watchTimeLimit'] = $context['watchTimeLimit']; } if (isset($context['hideBeginning'])) { $fields['data']['hideBeginning'] = $context['hideBeginning']; } $token = $this->getTokenService()->makeToken($type, $fields); return $token; }