Hacker Rhino
Hacker Rhino

Reputation: 15

I can't display videos, audio and images in Laravel PHP and HTML

I'm learning to display media on PHP. I use the following codes to display my videos and audio in my blade.php file and run it on Apache server of XAMPP. It displays an unloaded image and an unloaded video. I also installed laravelcollective/html class to my json file. Here are my codes:

<audio autoplay id="mainaudio">
   <source src="resources/views/Assets/kifflom_music.mp3">
</audio>
<video width="320" height="240" controls>
   <source src="resources/views/Assets/video.mp4" type="video/ogg">.
</video>

And here is what Edge and Opera GX displayed: enter image description here

, although a year ago, I run the same codes in a HTML file on Microsoft Edge and it did display the video and music, and now it displayed nothing. Don't know if the browsers don't support the and tags or it has some problems about cache of the computer. Any help is appreciated.

Upvotes: 0

Views: 1737

Answers (1)

Yagnik Detroja
Yagnik Detroja

Reputation: 929

Move you video and audio into public directory.

Create one directory inside public/media. put here your media.

then tried to link out them which below way.

<audio autoplay id="mainaudio">
   <source src="{{url('media/kifflom_music.mp3')}}">
</audio>

<video width="320" height="240" controls>
   <source src="{{url('media/video.mp4')}}" type="video/ogg">.
</video>

Upvotes: 1

Related Questions