title: How to view video files in laravel?
body: <p>I can't view video files from storage folder. My firebug shows ok response and showing some notice message. I think the problem is from</p>
  
  <pre><code>&lt;source src="'+response.profileVideo+'" type="video/webm"&gt;. 
  </code></pre>
  
  <p>Could you please check and help me to load video.</p>
  
  <p><strong>JS</strong></p>
  
  <pre><code>$( "#view-from-server" ).click(function(e){
  e.preventDefault();
  $.get("/profile/video", function(response){
      $( "#profile-video" ).html('&lt;video width="400" height="240" controls id="profile-video"&gt;&lt;source src="'+response.profileVideo+'" type="video/webm"&gt;&lt;/video&gt;');
  });
  </code></pre>
  
  <p><strong>Controller Page</strong></p>
  
  <pre><code>public function index()
  {
      $id                = Auth::user()-&gt;id;
      $details           = User::select('id', 'created_at')-&gt;find($id);
      $encrypt           = md5($details-&gt;id.$details-&gt;created_at);
      $directories       = Storage::files($encrypt);                                                  // Listout Files
      $webm              = preg_grep('/\/.*.webm$/', $directories);
      foreach($webm as $files){
          $split_folder_file = explode('/', $files);          //60e4dda43c442fe610bdbd4a0e5c3a12/4135209867745277.webm
          $splitted_file     = end($split_folder_file);       //4135209867745277.webm
          /*$file              = Storage::disk('local')-&gt;get($encrypt.'/'.$splitted_file);
          return response($file, 200)
              -&gt;header('Content-Type', 'video/webm');*/
          $userdata          = 'userdata';
          $filenameresult    = storage_path().'/'.$userdata.'/'.$encrypt.'/'.$splitted_file;
          return response()-&gt;json(['profileVideo' =&gt; $filenameresult]);
      }
  }
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div class="text-center"&gt;
     &lt;button type="button" class="btn btn-sm  btn-rounded btn-default" id="view-from-server"&gt;View Profile Video&lt;/button&gt;
              &lt;br&gt;
     &lt;div id="profile-video"&gt;&lt;/div&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p><strong>Firebug response</strong></p>
  
  <pre><code>"C:\xampp\htdocs\ct\storage/userdata/60e4dda43c442fe610bdbd4a0e5c3a12/8759253552413012.webm"
  </code></pre>
  
  <p><strong>Firebug Notice</strong></p>
  
  <pre><code>All candidate resources failed to load. Media load paused.
  </code></pre>
  
  <p><strong>Inspect with firebug</strong></p>
  
  <p>When I inspect the html with firebug the result shows given below.</p>
  
  <pre><code>&lt;div id="profile-video"&gt;
      &lt;video width="400" height="240" controls="" id="profile-video"&gt;
      &lt;source src="C:\xampp\htdocs\ct\storage/userdata/60e4dda43c442fe610bdbd4a0e5c3a12/9462835104782046.webm" type="video/webm"/&gt;
      &lt;/video&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p><strong>htaccess</strong></p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      &lt;IfModule mod_negotiation.c&gt;
          Options -MultiViews
      &lt;/IfModule&gt;
  
      RewriteEngine On
  
      # Redirect Trailing Slashes If Not A Folder...
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)/$ /$1 [L,R=301]
  
      # Handle Front Controller...
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^ index.php [L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/hjXRZ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hjXRZ.jpg" alt="enter image description here"></a></p>