Nova Video
  • 🏁Getting Started
    • Introduction
    • Installation
    • Support Us
    • License
  • 🚀Usage
    • Basic Usage
    • Usage with Larupload
    • Notes
  • ⚙️Advanced Usage
    • Video Metadata
    • Rest API Usage (Larupload)
    • Video Field Options
      • Make
      • Store With Larupload
      • Player Mode
      • Player Type
      • Direction (dir)
      • Max Height
      • Hide Cover Uploader
    • Configuration
      • UI
        • Player
          • Type
          • Direction (dir)
          • Max Height
      • Cover Uploader
      • Player Mode
  • ⚪Other
    • Demo
Powered by GitBook
On this page
  • Without Larupload
  • With Larupload
Edit on GitHub
  1. Advanced Usage

Video Metadata

Without Larupload

Even without using Larupload, you can still store and retrieve some essential video metadata. However, in this scenario, the available metadata is limited to the video's fileName and fileSize. You can achieve this using the built-in methods of Nova's File field.

<?php

namespace App\Nova;

use Illuminate\Http\Request;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use Mostafaznv\NovaVideo\Video;
use App\Models\IntroVideo as IntroVideoModel;
use Mostafaznv\NovaVideo\VideoMeta;

class IntroVideo extends Resource
{
    public static string $model = IntroVideoModel::class;

    public function fields(Request $request): array
    {
        return [
            ID::make()->sortable(),

            Video::make(trans('Video'), 'video', 'local')
                ->storeOriginalName('video_file_name')
                ->storeSize('video_file_size'),

            Text::make('Video Name', 'video_file_name')->exceptOnForms(),

            Text::make('Size', 'video_file_size')
                ->exceptOnForms()
                ->displayUsing(
                    fn($value) => number_format($value / 1024, 2).'kb'
                ),
        ];
    }
}


With Larupload

You can easily retrieve extracted metadata from videos using Larupload. This feature is specifically designed to work seamlessly with Larupload.

<?php

namespace App\Nova;

use Illuminate\Http\Request;
use Laravel\Nova\Fields\ID;
use Mostafaznv\NovaVideo\Video;
use App\Models\Media as MediaModel;
use Mostafaznv\NovaVideo\VideoMeta;


class Media extends Resource
{
    public static string $model = MediaModel::class;


    public function fields(Request $request): array
    {
        return [
            ID::make()->sortable(),
            Video::make(trans('Video'), 'video')->storeWithLarupload(),
           
            ...VideoMeta::make('video')->all(),
        ];
    }
}
<?php

namespace App\Nova;

use Illuminate\Http\Request;
use Laravel\Nova\Fields\ID;
use Mostafaznv\NovaVideo\Video;
use App\Models\Media as MediaModel;
use Mostafaznv\NovaVideo\VideoMeta;


class Media extends Resource
{
    public static string $model = MediaModel::class;


    public function fields(Request $request): array
    {
        return [
            ID::make()->sortable(),
            Video::make(trans('Video'), 'video')->storeWithLarupload(),

            VideoMeta::make('video')->fileName(),
            VideoMeta::make('video')->size(),
            VideoMeta::make('video')->mimeType(),
            VideoMeta::make('video')->width(),
            VideoMeta::make('video')->height(),
            VideoMeta::make('video')->duration(),
            VideoMeta::make('video')->format(),*/

        ];
    }
}

PreviousNotesNextRest API Usage (Larupload)

Last updated 1 year ago

For more details, please refer to .

⚙️
Nova's documentation