HTML5 video in ajax call

I want to call a video in an ajax request, it works, but not in different ways (it lacks the video player control buttons)
Here is my ajax code:

$.ajax({
    context: document.body,
    url: "/?get=json&act=video", 
    type: "get", 
    success: function(html) {  
          // console.log(JSON.parse(html)); 
          var a = JSON.parse(html);
          var returnVideo = "";
          a.forEach(function(element) {
          console.log(element);

            returnVideo += '    <div class="uk-card uk-card-hover uk-card-default">';   
            returnVideo += '        <div class="uk-card-media-top">'; 
            returnVideo += '    <video  width="" height="">';   
            returnVideo += '        <source src="'+element.gameClipUris[0].uri+'" type="video/mp4">';   
            returnVideo += '    </video>';  
            returnVideo += '        </div>';    
            returnVideo += '    </div><br />';  

          });
          $('#loading').hide("slow");
          $('#retourForm').append(returnVideo);
        }
});

Output: enter image description here

He has no video player control buttons!
I have a test to add a player with a hardcoded url and it works (right on the image) ...

enter image description here

So, I can not load the html5 player from javascript?

+4
source share
1 answer

You can add an attribute controlsto a tag video, for example <video controls></video>. Read the video tag for more details .

+1
source

Source: https://habr.com/ru/post/1672053/


All Articles