
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (69)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs
Sur d’autres sites (10375)
-
How to limit duration of the video with Dropzonejs ?
20 octobre 2017, par SNaReI have a form which I upload videos and duration/length of the video is important.
After I upload the file with PHP, I check the duration of the video file size with
FFMpeg
.I calculate duration in PHP and need to send value of the duration via PHP somehow. I think I have to append the duration to
$result
variable of Json.This is my html
<code class="echappe-js"><script src=<br />
"//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script><script src="https://rawgit.com/enyo/dropzone/master/dist/dropzone.js"></script>
<script type="text/javascript"><br />
<br />
Dropzone.options.myDropzone = {<br />
<br />
maxFiles: 1,<br />
acceptedFiles: "image/*,video/*",<br />
maxfilesexceeded: function (file) {<br />
this.removeAllFiles();<br />
this.addFile(file);<br />
$('#infomsg').hide();<br />
<br />
},<br />
<br />
init: function () {<br />
$('#infomsg').hide();<br />
<br />
this.on("success", function (result) {<br />
<br />
$('#infomsg').show();<br />
<br />
<br />
$("#boatAddForm").append($('<input type="hidden" ' +<br />
'name="files[]" ' +<br />
'value="' + result.name + '">'));<br />
<br />
});<br />
}<br />
};<br />
<br />
<br />
</script>This is the most minimal example of Dropzone. The upload in this
example doesn’t work, because there is no actual server to handle
the file upload.This is my PHP
<?php
$ds = DIRECTORY_SEPARATOR;
$storeFolder = 'uploads';
if (!empty($_FILES)) {
$tempFile = $_FILES['file']['tmp_name'];
$targetPath = dirname( __FILE__ ) . $ds. $storeFolder . $ds;
$targetFile = $targetPath. $_FILES['file']['name'];
move_uploaded_file($tempFile,$targetFile);
} else {
$result = array();
$files = scandir($storeFolder); //1
if ( false!==$files ) {
foreach ( $files as $file ) {
if ( '.'!=$file && '..'!=$file) { //2
$obj['name'] = $file;
$obj['size'] = filesize($storeFolder.$ds.$file);
$result[] = $obj;
}
}
}
header('Content-type: text/json'); //3
header('Content-type: application/json');
echo json_encode($result);
}If I could check a custom json response right after
Dropzone.options.myDropzone = {
like other requirements for success, I won’t have to right if statements in success in order to check the validation.
Basically I want to do it as I do like
maxFiles: 1,
without writing any conditions inside success
-
Introducing the Data Warehouse Connector feature
30 janvier, par Matomo Core Team -
Convert Webrtc track stream to URL (RTSP/UDP/RTP/Http) in Video tag
19 juillet 2020, par Zeeshan YounisI am new in WebRTC and i have done client/server connection, from client i choose WebCam and post stream to server using Track and on Server side i am getting that track and assign track stream to video source. Everything till now fine but problem is now i include AI(Artificial Intelligence) and now i want to convert my track stream to URL maybe UDP/RTSP/RTP etc. So AI will use that URL for object detection. I don't know how we can convert track stream to URL.
Although there is a couple of packages like https://ffmpeg.org/ and RTP to Webrtc etc, i am using Nodejs, Socket.io and Webrtc, below you can check my client and server side code for getting and posting stream, i am following thi github code https://github.com/Basscord/webrtc-video-broadcast.
Now my main concern is to make track as a URL for video tag, is it possible or not or please suggest, any help would be appreciated.


Server.js


This is nodejs server code



const express = require("express");
const app = express();

let broadcaster;
const port = 4000;

const http = require("http");
const server = http.createServer(app);

const io = require("socket.io")(server);
app.use(express.static(__dirname + "/public"));

io.sockets.on("error", e => console.log(e));
io.sockets.on("connection", socket => {
 socket.on("broadcaster", () => {
 broadcaster = socket.id;
 socket.broadcast.emit("broadcaster");
 });
 socket.on("watcher", () => {
 socket.to(broadcaster).emit("watcher", socket.id);
 });
 socket.on("offer", (id, message) => {
 socket.to(id).emit("offer", socket.id, message);
 });
 socket.on("answer", (id, message) => {
 socket.to(id).emit("answer", socket.id, message);
 });
 socket.on("candidate", (id, message) => {
 socket.to(id).emit("candidate", socket.id, message);
 });
 socket.on("disconnect", () => {
 socket.to(broadcaster).emit("disconnectPeer", socket.id);
 });
});
server.listen(port, () => console.log(`Server is running on port ${port}`));







Broadcast.js
This is the code for emit stream(track)



const peerConnections = {};
const config = {
 iceServers: [
 {
 urls: ["stun:stun.l.google.com:19302"]
 }
 ]
};

const socket = io.connect(window.location.origin);

socket.on("answer", (id, description) => {
 peerConnections[id].setRemoteDescription(description);
});

socket.on("watcher", id => {
 const peerConnection = new RTCPeerConnection(config);
 peerConnections[id] = peerConnection;

 let stream = videoElement.srcObject;
 stream.getTracks().forEach(track => peerConnection.addTrack(track, stream));

 peerConnection.onicecandidate = event => {
 if (event.candidate) {
 socket.emit("candidate", id, event.candidate);
 }
 };

 peerConnection
 .createOffer()
 .then(sdp => peerConnection.setLocalDescription(sdp))
 .then(() => {
 socket.emit("offer", id, peerConnection.localDescription);
 });
});

socket.on("candidate", (id, candidate) => {
 peerConnections[id].addIceCandidate(new RTCIceCandidate(candidate));
});

socket.on("disconnectPeer", id => {
 peerConnections[id].close();
 delete peerConnections[id];
});

window.onunload = window.onbeforeunload = () => {
 socket.close();
};

// Get camera and microphone
const videoElement = document.querySelector("video");
const audioSelect = document.querySelector("select#audioSource");
const videoSelect = document.querySelector("select#videoSource");

audioSelect.onchange = getStream;
videoSelect.onchange = getStream;

getStream()
 .then(getDevices)
 .then(gotDevices);

function getDevices() {
 return navigator.mediaDevices.enumerateDevices();
}

function gotDevices(deviceInfos) {
 window.deviceInfos = deviceInfos;
 for (const deviceInfo of deviceInfos) {
 const option = document.createElement("option");
 option.value = deviceInfo.deviceId;
 if (deviceInfo.kind === "audioinput") {
 option.text = deviceInfo.label || `Microphone ${audioSelect.length + 1}`;
 audioSelect.appendChild(option);
 } else if (deviceInfo.kind === "videoinput") {
 option.text = deviceInfo.label || `Camera ${videoSelect.length + 1}`;
 videoSelect.appendChild(option);
 }
 }
}

function getStream() {
 if (window.stream) {
 window.stream.getTracks().forEach(track => {
 track.stop();
 });
 }
 const audioSource = audioSelect.value;
 const videoSource = videoSelect.value;
 const constraints = {
 audio: { deviceId: audioSource ? { exact: audioSource } : undefined },
 video: { deviceId: videoSource ? { exact: videoSource } : undefined }
 };
 return navigator.mediaDevices
 .getUserMedia(constraints)
 .then(gotStream)
 .catch(handleError);
}

function gotStream(stream) {
 window.stream = stream;
 audioSelect.selectedIndex = [...audioSelect.options].findIndex(
 option => option.text === stream.getAudioTracks()[0].label
 );
 videoSelect.selectedIndex = [...videoSelect.options].findIndex(
 option => option.text === stream.getVideoTracks()[0].label
 );
 videoElement.srcObject = stream;
 socket.emit("broadcaster");
}

function handleError(error) {
 console.error("Error: ", error);
}







RemoteServer.js
This code is getting track and assign to video tag



let peerConnection;
const config = {
 iceServers: [
 {
 urls: ["stun:stun.l.google.com:19302"]
 }
 ]
};

const socket = io.connect(window.location.origin);
const video = document.querySelector("video");

socket.on("offer", (id, description) => {
 peerConnection = new RTCPeerConnection(config);
 peerConnection
 .setRemoteDescription(description)
 .then(() => peerConnection.createAnswer())
 .then(sdp => peerConnection.setLocalDescription(sdp))
 .then(() => {
 socket.emit("answer", id, peerConnection.localDescription);
 });
 peerConnection.ontrack = event => {
 video.srcObject = event.streams[0];
 };
 peerConnection.onicecandidate = event => {
 if (event.candidate) {
 socket.emit("candidate", id, event.candidate);
 }
 };
});

socket.on("candidate", (id, candidate) => {
 peerConnection
 .addIceCandidate(new RTCIceCandidate(candidate))
 .catch(e => console.error(e));
});

socket.on("connect", () => {
 socket.emit("watcher");
});

socket.on("broadcaster", () => {
 socket.emit("watcher");
});

socket.on("disconnectPeer", () => {
 peerConnection.close();
});

window.onunload = window.onbeforeunload = () => {
 socket.close();
};