Support the ongoing development of Laravel.io →
posted 8 years ago
Laravel.io
Last updated 1 year ago.
0

resolved!

my route:

Route::get('get-video/{video}', 'SiteController@getVideo')->name('getVideo');

my controller action:

public function getVideo(Video $video)
{
    $name = $video->name;
    $fileContents = Storage::disk('local')->get("uploads/videos/{$name}");
    $response = Response::make($fileContents, 200);
    $response->header('Content-Type', "video/mp4");
    return $response;
}

my view:

<video width="320" height="240" controls>
        <source src="{{ route('getVideo', $video->id)  }}" type="video/mp4">
        Your browser does not support the video tag.
</video>
Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

hamo2015 hamo2015 Joined 28 Apr 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.