حالت آفلاین — محتوا از حافظهٔ کش نمایش داده می‌شود
همهٔ تمرین‌ها

نمایش ویدیو در صفحه

تمرین آسان 1486 visibility link download flag

کدی بنویسید که ویدیویی با آدرس (test) را در صفحه بارگذاری کند. دکمه های کنترل ویدیو نیز وجود داشته باشد

👨‍💻 12 ساعت قبل User 10940 این تمرین رو مشاهده کرد
👨‍💻 20 ساعت قبل کاربر ناشناس این تمرین رو مشاهده کرد

پاسخ‌ها 13

<!DOCTYPE html>
<html lang="fa">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>پخش ویدیو</title>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #f0f0f0;
            font-family: Arial, sans-serif;
        }

        video {
            width: 80%;
            max-width: 600px;
            border: 1px solid #ccc;
            border-radius: 8px;
        }

        .controls {
            margin-top: 10px;
            display: flex;
            justify-content: center;
        }

        button {
            padding: 10px 15px;
            margin: 0 5px;
            border: none;
            border-radius: 5px;
            background-color: #007bff;
            color: white;
            cursor: pointer;
            font-size: 16px;
        }

        button:hover {
            background-color: #0056b3;
        }
    </style>
</head>
<body>
    <video id="myVideo" controls>
        <source src="test.mp4" type="video/mp4"> <!-- آدرس ویدیو -->
        مرورگر شما از تگ ویدیو پشتیبانی نمی‌کند.
    </video>

    <div class="controls">
        <button onclick="playVideo()">پخش</button>
        <button onclick="pauseVideo()">توقف</button>
        <button onclick="stopVideo()">متوقف کردن</button>
    </div>

    <script>
        const video = document.getElementById('myVideo');
        function playVideo() {
            video.play();
        }

        function pauseVideo() {
            video.pause();
        }

        function stopVideo() {
            video.pause();
            video.currentTime = 0; // ویدیو را به ابتدا برمی‌گرداند
        }
    </script>

</body>
</html>
<!DOCTYPE html>
<html lang="fa";>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport " content="width=device-width,intial-scale=1.0">
    </head>
    <body>
        <video content="width=device-width,intial-scale=1.0" controls autoplay muted >
            <source src="test.mp4" type="video/mp4">
            <track src="test.vtt" kind="subtitles" srclang='fa' label="farsi"> 
        </video>
    </body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>نمایش ویدیو</title>
</head>
<body>
    <video src="text.mp4" controls></video>
</body>
</html>

ارسال جواب

جوابت را با Markdown بنویس و ثبت کن

×
بستن