स्क्रिप्ट से वीडियो निर्माण

स्क्रिप्ट से वीडियो निर्माण


वीडियो परिणाम:

 <!DOCTYPE html>

<html lang="hi">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>स्क्रिप्ट से वीडियो निर्माण</title>

    <style>

        body {

            font-family: Arial, sans-serif;

            background-color: #f0f0f0;

            padding: 20px;

        }

        #container {

            max-width: 600px;

            margin: 0 auto;

            background-color: white;

            padding: 20px;

            border-radius: 8px;

            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);

        }

        textarea {

            width: 100%;

            height: 150px;

            padding: 10px;

            margin-bottom: 20px;

            border-radius: 5px;

            border: 1px solid #ddd;

            font-size: 16px;

        }

        button {

            padding: 10px 20px;

            background-color: #4CAF50;

            color: white;

            border: none;

            border-radius: 5px;

            cursor: pointer;

            font-size: 16px;

        }

        button:hover {

            background-color: #45a049;

        }

        #videoContainer {

            margin-top: 20px;

            display: none;

        }

    </style>

</head>

<body>


<div id="container">

    <h2>स्क्रिप्ट से वीडियो निर्माण</h2>

    <textarea id="scriptInput" placeholder="अपनी स्क्रिप्ट यहाँ दर्ज करें..."></textarea><br>

    <button id="generateVideoBtn">वीडियो निर्माण करें</button>


    <div id="videoContainer">

        <h3>वीडियो परिणाम:</h3>

        <video id="resultVideo" controls></video>

    </div>

</div>


<script>

    document.getElementById('generateVideoBtn').addEventListener('click', function() {

        var script = document.getElementById('scriptInput').value;


        if (script.trim() === '') {

            alert('कृपया स्क्रिप्ट दर्ज करें');

            return;

        }


        // AI API को कॉल करने के लिए कोड

        // उदाहरण के लिए, हम यहां एक काल्पनिक API का उपयोग कर रहे हैं


        // इसे असल में API से कनेक्ट करने के लिए बदलें

        var apiUrl = 'https://example-ai-video-api.com/create-video';

        var data = {

            script: script

        };


        // फेच API के जरिए डेटा भेजने का तरीका

        fetch(apiUrl, {

            method: 'POST',

            headers: {

                'Content-Type': 'application/json',

            },

            body: JSON.stringify(data),

        })

        .then(response => response.json())

        .then(data => {

            if (data.videoUrl) {

                document.getElementById('videoContainer').style.display = 'block';

                document.getElementById('resultVideo').src = data.videoUrl;

            } else {

                alert('वीडियो बनाने में त्रुटि');

            }

        })

        .catch(error => {

            console.error('Error:', error);

            alert('कुछ गलती हो गई');

        });

    });

</script>


</body>

</html>


Comments

Popular posts from this blog