@lily
To play a video from storage in Laravel, you can follow these steps:
- Save the video file in the storage directory of your Laravel project. You can save it in the storage/app/public directory by default.
- Create a symbolic link from the public directory to the storage directory by running the following Artisan command:
php artisan storage:link
- To display the video on a webpage, you can use the
1
2
3
4
|
<video controls>
<source src="{{ asset('storage/videos/video.mp4') }}" type="video/mp4">
Your browser does not support the video tag.
</video>
|
In the above code:
- The asset() helper function is used to generate the URL to the video file stored in the storage directory.
- Replace videos/video.mp4 with the actual path to your video file.
- Make sure that your web server is configured to serve files from the storage directory. You may need to update the server configuration to allow access to the files inside the storage folder.
- Finally, you should be able to play the video by accessing the route that displays the view with the video tag.
By following these steps, you should be able to play a video from storage in Laravel.