mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 02:39:46 +02:00
Update
This commit is contained in:
parent
ca089ec17e
commit
a71f0f4c55
3 changed files with 10 additions and 4 deletions
|
@ -70,13 +70,19 @@ function sendStreamToServer(stream) {
|
|||
console.error('MediaRecorder error:', event.error);
|
||||
};
|
||||
|
||||
mediaRecorder.start(1000); // Record and send chunks every second
|
||||
const chunkSize = isIPhone() ? 250 : 1000; // 250ms for iPhone, 1000ms for others
|
||||
mediaRecorder.start(chunkSize); // Record and send chunks every second
|
||||
console.log(`MediaRecorder started`);
|
||||
} catch (error) {
|
||||
console.error('Failed to initialize MediaRecorder:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// Detect if the device is an iPhone
|
||||
function isIPhone() {
|
||||
return /iPhone|iPad|iPod/i.test(navigator.userAgent);
|
||||
}
|
||||
|
||||
// Function to stop the MediaRecorder
|
||||
function stopStreamToServer() {
|
||||
if (mediaRecorder && mediaRecorder.state !== 'inactive') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue