سلام , من درست در زمان 11:20 به این ارور بر می خورم :
Target [Alchemy\BinaryDriver\ProcessBuilderFactoryInterface] is not instantiable while building [App\Http\Controllers\FileController, App\Services\Uploader\Uploader, FFMpeg\FFMpeg, FFMpeg\Driver\FFMpegDriver].
لطفا راهنمایی کنید
در نسخه جدید ffmpeg ساخت نمونه تغییر کرده و باید داخل AppServiceProvider به شکل زیر این مورد رو bind کنید.
$this->app->bind(FFMpeg::class, function ($app) {
return FFMpeg\FFMpeg::create();
});
<?php
// Uploader.php
namespace App\Services\Uploader;
use FFMpeg\FFMpeg;
use Illuminate\Http\Request;
class Uploader
{
private $request;
private $storageManager;
private $file;
private $ffmpeg;
public function __construct(Request $request, StorageManager $storageManager,FFMpeg $ffmpeg)
{
$this->request = $request;
$this->storageManager = $storageManager;
$this->file = $request->file;
$this->ffmpeg = $ffmpeg;
}
public function upload()
{
$this->putFileIntoStorage();
dd($this->ffmpeg->durationOf($this->storageManager->getAbsolutePathOf($this->file->getClientOriginalName(), $this->getType(),$this->isPrivate())));
}
private function putFileIntoStorage()
{
$method = $this->isPrivate() ? 'putFileAsPrivate' : 'putFileAsPublic';
$this->storageManager->$method($this->file->getClientOriginalName(), $this->file, $this->getType());
}
private function getType()
{
return [
'image/jpg' => 'image',
'image/jpeg' => 'image',
'video/mp4' => 'video',
'application/zip' => 'archive',
][$this->file->getClientMimeType()];
}
private function isPrivate()
{
return $this->request->has('private');
}
}