七牛云 视频上传 分块加密

七牛云 视频上传

            $persistentOps1 = [
                'avthumb/m3u8',
                'noDomain/1',

                'hlsKey/'.base64_encode($data['hlskey']),
                'hlsKeyType/0',
                'hlsKeyUrl/'.base64_encode($_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST']."/public/up-play-check?vid=".$data['v_id']),
            ];
            // $fimg = "v_vframe_".$data['v_id'].".jpg";
            // $saveJpgEntry = \Qiniu\base64_urlSafeEncode( "static-test:".$fimg );
            // $persistentOps2 = "vframe/jpg/offset/1|saveas/" . $saveJpgEntry;
            $persistentOps2 = "vframe/jpg/offset/1";

            $callbackBody = [
                'key'=>'$(key)',
                'hash'=>'$(etag)',
                'fsize'=>'$(fsize)',
                'ftype'=>'$(ext)',
                'fname'=>'$(fname)',
                'fduration'=>'$(avinfo.video.duration)',
                'fid'=>$data['v_id'],
            ];
            
            $policy = array(
                'persistentOps' => join('/',$persistentOps1).';'.$persistentOps2,
                'persistentPipeline' => 'videomp4',
                'persistentNotifyUrl' => $_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST']."/public/up-notify?vid=".$data['v_id'],

                'callbackBody'=>json_encode($callbackBody),
                'callbackUrl'=>$_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST']."/public/video-update",
            );
            $this->token = $this->getAuth()->uploadToken( $data['bucket'], null, 3600, $policy, true );

 

发表评论

电子邮件地址不会被公开。