Цэрэнчимэд Цэгмид Posted January 31, 2021 Share Posted January 31, 2021 Hello. I am new in Ant Media. I am using WebRTC to stream. Is there any feature that capture image from stream? I want to capture latest stream image if broadcasting. Just like twitch and others. Link to comment Share on other sites More sharing options...
0 Цэрэнчимэд Цэгмид Posted January 31, 2021 Author Share Posted January 31, 2021 I Found configuration that generates preview of image. But in my server there is no previews folder in webapps.Is WebRTC stream does not support preview or i have to do additional configuration? I am using Enterprise Edition of AMS Link to comment Share on other sites More sharing options...
0 Louis Veronneau Posted January 31, 2021 Share Posted January 31, 2021 Hi I tried to get the image from the client, grab from the stream then upload to server but for some reason i cant get it to work. where did you find this config to make a preview ? here is the code : var firstVideoTrack; navigator.mediaDevices.getUserMedia({ video: true }) .then(mediaStream => { firstVideoTrack = mediaStream.getVideoTracks()[0]; }); var imageinterval; var imageCapture; var photo; function captureimage(){ imageCapture = new ImageCapture(firstVideoTrack); imageCapture.takePhoto().then(function(blob) { photo = URL.createObjectURL(blob); document.getElementById('capture').src=photo; var formData = new FormData(); formData.append( "FILES[]", photo ); $.ajax({ url: "upload_camimages.php", type: "POST", enctype: 'multipart/form-data', processData: false, // Important! contentType: false, cache: false, data: formData, }) } ) } thanks Link to comment Share on other sites More sharing options...
0 Louis Veronneau Posted January 31, 2021 Share Posted January 31, 2021 yes cant find the preview dir ?? Link to comment Share on other sites More sharing options...
0 Louis Veronneau Posted January 31, 2021 Share Posted January 31, 2021 ok yes preview works, need to set the Adaptive Streaming active but it is a bummer using so much server processor for this Link to comment Share on other sites More sharing options...
0 Цэрэнчимэд Цэгмид Posted January 31, 2021 Author Share Posted January 31, 2021 Does Preview works only when Adaptive Stream? I will try your code. I was looking for built in feature. Looks like If Preview does not work, Capturing from video source is only way i think Link to comment Share on other sites More sharing options...
0 Tahir Posted February 3, 2021 Share Posted February 3, 2021 Hi, Thank you for your contribution to the community. I am sorry to say this but 2.2.1 version is problematic with the previews, I don't recommend to use previews in that version ( https://github.com/ant-media/Ant-Media-Server/issues/2801 ) You can indeed capture the stream from client side in the javascript, you can draw the stream on top a canvas and get the image from toDataUrl method if client side capturing is good enough for you. Thanks Link to comment Share on other sites More sharing options...
Question
Цэрэнчимэд Цэгмид
Hello. I am new in Ant Media. I am using WebRTC to stream.
Link to comment
Share on other sites
Top Posters For This Question
3
3
1
Popular Days
Jan 31
6
Feb 3
1
Top Posters For This Question
Louis Veronneau 3 posts
Цэрэнчимэд Цэгмид 3 posts
Tahir 1 post
Popular Days
Jan 31 2021
6 posts
Feb 3 2021
1 post
6 answers to this question
Recommended Posts