File size: 1,560 Bytes
848a109
68e03ff
848a109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68e03ff
baba7b1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html>
<head>
    <title>Player de vídeo estilo YouTube</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
</head>
<body>
    <div class="container">
        <div class="row">
            <div class="col-md-8 offset-md-2">
                <h1>Player de vídeo</h1>
                <form id="video-form">
                    <div class="form-group">
                        <label for="video-url">URL do vídeo:</label>
                        <input type="text" class="form-control" id="video-url" placeholder="Cole a URL do vídeo">
                    </div>
                    <button type="submit" class="btn btn-primary">Reproduzir</button>
                </form>
                <div id="video-player" class="mt-4"></div>
            </div>
        </div>
    </div>
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
    <script>
        $(document).ready(function() {
            $("#video-form").submit(function(event) {
                event.preventDefault();
                var videoUrl = $("#video-url").val();
                var videoPlayer = `
                    <video width="640" height="480" controls>
                        <source src="${videoUrl}" type="video/mp4">
                    </video>
                `;
                $("#video-player").html(videoPlayer);
            });
        });
    </script>
</body>
</html>