Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hope this helps with bot sending video #12

Open
s-b-repo opened this issue Mar 13, 2023 · 12 comments
Open

hope this helps with bot sending video #12

s-b-repo opened this issue Mar 13, 2023 · 12 comments

Comments

@s-b-repo
Copy link
Contributor

You can use various video processing libraries like FFmpeg or GStreamer to manipulate the video files and streaming protocols like HLS or MPEG-DASH to serve them over the internet. You can also use third-party APIs like Cloudinary or Amazon S3 to store and retrieve the video files. However, it's important to note that enabling a chat AI to send videos on a self-hosted website could potentially create legal or ethical issues, especially if the videos are not moderated or monitored for inappropriate content. It's important to carefully consider the implications of such a feature before implementing it.

Sure, here's an example of how you could allow a chat AI to send videos on a self-hosted website using HTML and JavaScript:

First, create an HTML form with an input field for the user to upload a video file:

python

Next, create a JavaScript function to handle the form submission and send the video file to the server using AJAX:

javascript

function uploadVideo() {
var file = document.querySelector('input[type="file"]').files[0];
var xhr = new XMLHttpRequest();
xhr.open('POST', 'upload.php', true);
xhr.upload.onprogress = function(e) {
if (e.lengthComputable) {
var percentComplete = (e.loaded / e.total) * 100;
console.log(percentComplete + '% uploaded');
}
};
xhr.onload = function() {
if (this.status === 200) {
console.log('Video uploaded!');
} else {
console.error('Error uploading video');
}
};
var formData = new FormData();
formData.append('video', file);
xhr.send(formData);
}

Finally, create a PHP script to handle the video upload and store the video file on the server:

php

Note that this code is just an example and would need to be customized to fit your specific website and use case.

Here's an alternative implementation of the same functionality using Node.js and the Express framework:

First, install the necessary dependencies by running the following command in your project directory:

npm install express multer

Next, create a server.js file with the following code:

javascript

const express = require('express');
const multer = require('multer');
const app = express();
const upload = multer({ dest: 'uploads/' });

app.post('/upload', upload.single('video'), (req, res) => {
if (!req.file) {
return res.status(400).send('No video uploaded');
}
res.send('Video uploaded successfully');
});

app.listen(3000, () => {
console.log('Server listening on port 3000');
});

Finally, create an HTML form with an input field for the user to upload a video file, and use JavaScript to submit the form to the server:

php

<script> const form = document.querySelector('form'); form.addEventListener('submit', (e) => { e.preventDefault(); const xhr = new XMLHttpRequest(); xhr.open('POST', '/upload'); xhr.onload = () => { console.log(xhr.responseText); }; const formData = new FormData(form); xhr.send(formData); }); </script>

Again, note that this code is just an example and would need to be customized to fit your specific website and

@RaSan147
Copy link
Owner

Question: why would a user send video to a chat bot? This ain't telegeam with unlimited storage.

@s-b-repo
Copy link
Contributor Author

Question: why would a user send video to a chat bot? This ain't telegeam with unlimited storage.

this for ai on your ro do list

@s-b-repo
Copy link
Contributor Author

Allow bot send video

@RaSan147
Copy link
Owner

Not planning to add such thing in distant future. This is a chatbot, at max I'll add sending photo (only from ai, not from user) to keep power usage and complexity low

@s-b-repo
Copy link
Contributor Author

Not planning to add such thing in distant future. This is a chatbot, at max I'll add sending photo (only from ai, not from user) to keep power usage and complexity low

you could let it send some videos like youtube videos or twitch clips

@RaSan147
Copy link
Owner

Yes will do that, but Instead of downloading, will allow embedded code with video playback.

@RaSan147
Copy link
Owner

RaSan147 commented Mar 14, 2023

Planning to add YouTube video player API
https://developers.google.com/youtube/iframe_api_reference

Also have "plyr" in mind.
Demo command: "play something"
Player position on side bar, so that one can chat with music on ( by hiding sidebar)
Or on top of page (not voting for this one)

Issue on using anything YouTube : on Android playback will stop when user leaves screen (uncontrollable)

@s-b-repo
Copy link
Contributor Author

try newpipes method

@RaSan147
Copy link
Owner

try newpipes method

Interesting app, sadly its an app. Can you find any web alternative with api

@s-b-repo
Copy link
Contributor Author

invidius

@RaSan147
Copy link
Owner

CORS issue on Hotlinking to player

@RaSan147
Copy link
Owner

Noted, will add in future updates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants