|
@@ -5,16 +5,15 @@ use AlibabaCloud\Client\Exception\ClientException;
|
|
|
use AlibabaCloud\Client\Exception\ServerException;
|
|
|
use AlibabaCloud\SDK\Vod\V20170321\Vod;
|
|
|
use AlibabaCloud\SDK\Vod\V20170321\Models\GetPlayInfoRequest;
|
|
|
-use \Exception;
|
|
|
-use library\File;
|
|
|
use AlibabaCloud\Tea\Exception\TeaError;
|
|
|
-use AlibabaCloud\Tea\Utils\Utils;
|
|
|
use Darabonba\OpenApi\Models\Config;
|
|
|
use AlibabaCloud\SDK\Vod\V20170321\Models\CreateUploadVideoRequest;
|
|
|
+use AlibabaCloud\SDK\Vod\V20170321\Models\RefreshUploadVideoRequest;
|
|
|
use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
|
|
|
+use AlibabaCloud\Tea\Utils\Utils;
|
|
|
+use \Exception;
|
|
|
use AlibabaCloud\SDK\Vod\V20170321\Models\GetVideoPlayAuthRequest;
|
|
|
require_once '../vendor/aliyunmail/aliyun-php-sdk-core/Config.php'; // 假定您的源码文件和aliyun-php-sdk处于同一目录
|
|
|
-//require '../vendor/autoload.php';
|
|
|
$path = __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
|
|
|
if (file_exists($path)) require_once $path;
|
|
|
|
|
@@ -117,9 +116,10 @@ class VideoDemand extends Base
|
|
|
* @desc 获取视频上传凭证
|
|
|
* @author qc
|
|
|
* @url /api/Video_demand/createUploadVideo
|
|
|
- * @method GET
|
|
|
+ * @method POST
|
|
|
* @tag 获取视频上传凭证
|
|
|
* @header name:Authorization require:1 desc:Token
|
|
|
+ * @name name:file type:string default:-- desc:视频文件
|
|
|
* @return name:requestId type:string default:-- desc:requestId
|
|
|
* @return name:uploadAddress type:string default:-- desc:uploadAddress
|
|
|
* @return name:uploadAuth type:string default:-- desc:uploadAuth
|
|
@@ -153,6 +153,45 @@ class VideoDemand extends Base
|
|
|
$this->success('ok',$res_arr['body']);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @title 刷新视频上传凭证
|
|
|
+ * @desc 刷新视频上传凭证
|
|
|
+ * @author qc
|
|
|
+ * @url /api/Video_demand/refreshUploadVideoToken
|
|
|
+ * @method GET
|
|
|
+ * @tag 获取视频上传凭证
|
|
|
+ * @header name:Authorization require:1 desc:Token
|
|
|
+ * @header name:Authorization require:1 desc:Token
|
|
|
+ * @param name:videoId type:string default:-- desc:videoId
|
|
|
+ * @return name:uploadAddress type:string default:-- desc:uploadAddress
|
|
|
+ * @return name:uploadAuth type:string default:-- desc:uploadAuth
|
|
|
+ * @return name:videoId type:string default:-- desc:videoId
|
|
|
+ */
|
|
|
+ public function refreshUploadVideoToken()
|
|
|
+ {
|
|
|
+ $client = self::createClient($this->access_key, $this->access_secret);
|
|
|
+ $refreshUploadVideoRequest = new RefreshUploadVideoRequest([
|
|
|
+ 'videoId'=>input('ali_vid'),
|
|
|
+ ]);
|
|
|
+ $runtime = new RuntimeOptions([]);
|
|
|
+ try {
|
|
|
+ // 复制代码运行请自行打印 API 的返回值
|
|
|
+ $res = $client->refreshUploadVideoWithOptions($refreshUploadVideoRequest, $runtime);
|
|
|
+ $json_res = json_encode($res,true);
|
|
|
+ $res_arr = json_decode($json_res,true);
|
|
|
+ }
|
|
|
+ catch (\Exception $error) {
|
|
|
+ if (!($error instanceof TeaError)) {
|
|
|
+ $error = new TeaError([], $error->getMessage(), $error->getCode(), $error);
|
|
|
+ }
|
|
|
+ $this->error($error->message);
|
|
|
+ }
|
|
|
+ $this->success('ok',$res_arr['body'] );
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* @title 获取视频播放凭证[通过视频ID获取]
|
|
|
* @desc 获取视频播放凭证[通过视频ID获取]
|
|
@@ -162,13 +201,16 @@ class VideoDemand extends Base
|
|
|
* @tag 视频播放凭证
|
|
|
* @header name:Authorization require:1 desc:Token
|
|
|
* @param name:ali_vid type:int require:1 default:0 desc:ali_vid
|
|
|
- * @return name:playAuth type:string default:-- desc:playAuth
|
|
|
+ * @return name:playAuth type:string default:-- desc:playAuth(时效3000s)
|
|
|
* @return name:requestId type:string default:-- desc:requestId
|
|
|
*/
|
|
|
public function getVideoCredentialsByVideoId()
|
|
|
{
|
|
|
$client = self::createClient($this->access_key, $this->access_secret);
|
|
|
- $getVideoPlayAuthRequest = new GetVideoPlayAuthRequest(['videoId'=>input('ali_vid')]);
|
|
|
+ $getVideoPlayAuthRequest = new GetVideoPlayAuthRequest([
|
|
|
+ 'videoId'=>input('ali_vid'),
|
|
|
+ "authInfoTimeout" => 3000
|
|
|
+ ]);
|
|
|
$runtime = new RuntimeOptions([]);
|
|
|
try {
|
|
|
$res = $client->getVideoPlayAuthWithOptions($getVideoPlayAuthRequest, $runtime);
|