我找到了一种获取视频时长的简单方法
我在Google上搜索了一些可以帮助我的内容,但没有具体内容,因此,我想请您得到答案
public function postNewVideo( $id, Request $request ){
$name = $request->name;
$source = $request->source;
$idValide = User::where('id', $id)->get('id');
$idValide = $idValide[0]->id;
if ($id == $idValide) {
if ($name != "" || $source != "") {
$retour = testToken();
if($retour == TRUE) {
$extension = $request['source']->extension();
$videoName = $name . '.' . $extension;
$request->file('source')->move(public_path("/"), $videoName);
$fileUrl = url('/' . $videoName);
//$duration_string = $request['source']['playtime_string'];
//return $duration_string;
Video::create(['name' => $name, 'user_id' => $id, 'source' => $fileUrl, , 'duration' => $duration, 'view' =>'0', 'enabled'=>'0']);
$res = Video::where('name', $name)->get();
return response()->json(['message' => 'OK', 'data' => $res], 201);
} else {
return response()->json([
'message'=>'Forbidden',
]
,403);
}
} else {
return response()->json(['message' => 'Bad Request', 'code' => '10001'], 400);
}
} else {
return response()->json(['message' => 'Not found'], 404);
}
}
所以,这就是我得到的
您可以看到持续时间为空,因为我不知道。