PHP code example of think.studio / nova-chunked-video
1. Go to this page and download the library: Download think.studio/nova-chunked-video library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
think.studio / nova-chunked-video example snippets
\NovaChunkedVideo\ChunkedVideo::make( 'Video', 'big_video' )
->acceptedTypes( 'video/mp4' )
->disk( 'my_private_disk' )
->store( function ( $filePath, $disk, $model, $attribute, $request ) {
// something like delete old video and save new
$model->big_video = $filePath;
$model->save();
// WARNING: response should return url.
return Storage::disk($disk)->url($filePath);
} )
->preview( function ($value, $disk, $model ) {
return Storage::disk($disk)->url($value);
} )
->download(function (NovaRequest $request, Model $model, ?string $disk, $value) {
return $value ? Storage::disk($disk)->download($value) : null;
})
->delete(function (NovaRequest $request, $model, ?string $disk, $value) {
if ($value) {
Storage::disk($disk)->delete($value);
}
return true;
})
->help( 'Usually a large video: 0.5-2GB. Max size 3GB' ),
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.