master
cn.yimian.xyz 4 years ago
parent dd57cceab9
commit 772494313f
  1. 6
      functions.php
  2. 2
      index.php

@ -294,7 +294,7 @@ use Obs\ObsClient;
/* obs get video */ /* obs get video */
function getVideo($path, $time = 120*60){ function getVideo($path, $time = 120*60){
return obsSign($path, $time); return obsSign($path, $time, 'yimian-video');
} }
@ -307,7 +307,7 @@ function getImg($path, $time = 300){
function obsSign($path, $expires = 300){ function obsSign($path, $expires = 300, $bucket = 'yimian-image'){
$obsClient = new ObsClient([ $obsClient = new ObsClient([
'key' => $GLOBALS['huawei_AK'], 'key' => $GLOBALS['huawei_AK'],
@ -318,7 +318,7 @@ function obsSign($path, $expires = 300){
$resp = $obsClient->createSignedUrl( [ $resp = $obsClient->createSignedUrl( [
'Method' => 'GET', 'Method' => 'GET',
'Bucket' => 'yimian-image', 'Bucket' => $bucket,
'Key' => $path, 'Key' => $path,
'Expires' => $expires 'Expires' => $expires
] ); ] );

@ -6,7 +6,7 @@ header('Access-Control-Allow-Origin:*');
header('content-type: video/mp4'); //header('content-type: video/mp4');
$path = $_REQUEST['path']; $path = $_REQUEST['path'];

Loading…
Cancel
Save