Тёмный

Capturing and Saving User Audio or Video with JavaScript 

Steve Griffith - Prof3ssorSt3v3
Подписаться 100 тыс.
Просмотров 106 тыс.
50% 1

If you want to access the microphone and webcam on the user's laptop or phone then the getUserMedia method from the MediaStream API is what you need.
This video talks about how to access the camera and microphone as well as how you can record and save the data that you capture.
An alternative not covered here is saving screenshots from video onto an HTML Canvas element and then saving that in an image element or form input element.
Code GIST: gist.github.com/prof3ssorSt3v...
Promises Playlist: • JavaScript ES6 Promise...

Опубликовано:

 

31 май 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 440   
@zachbaird2851
@zachbaird2851 4 года назад
As someone getting up to speed on this for an application at work, you have provided an excellent description on how this stuff works and how to work with it. Thanks a lot Steve, I'll be looking at more of your content in the future!
@Sindoku
@Sindoku 5 лет назад
This is the coolest stuff ever I have been searching for more about dealing with media both audio and video. I'd like to build a streaming service that simply let's you talk with other users and even group video chats, but it's felt like this knowledge was too hard to come by for me to get started. You have the clearest voice and most accurate and concise explanations I have ever seen. I am relatively new to programming, I've only been doing it for about a year and I have been self-taught this whole time; however I have just joined Lambda School 6 weeks ago, and as I was going over some of the challenges, and I came across your videos which I used for extra practice and even more clarity and understanding than what I was being taught at Lambda school, and I have to say that I do believe Lambda school is one of the best computer science + web development schools in the world, so you are really, really good for me to say that you're better than they are at teaching, and I have fallen in love with the way you explain things. Thank you thank you for sharing your knowledge with plebs like myself.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 5 лет назад
Thanks Brian.
@amycross5430
@amycross5430 5 лет назад
You are a genius when It comes to teaching. Best tutorial ever!
@zuful
@zuful 4 года назад
I tried several tutorials about this API, non of them worked, I was about to give up and try another solution when I found your video. Everything works fine so thanks a lot sir!
@AndyRocket1000
@AndyRocket1000 11 месяцев назад
Your toturials are really good. I built the program and feel happy about it. Now i cant waith to make my own filters and send it places! Make video calls with crazy custom filters😛Thanx🙌🏻
@kevinflorenzdaus
@kevinflorenzdaus 3 года назад
been looking for contents like this in awhile. Thanks man!. kudos! keep it up!
@odyo666
@odyo666 Год назад
Great concept explanation, clean audio ! Direct to the point ! You have excelent teaching skills ! Thank you !
@RobertWildling
@RobertWildling Год назад
Thank you for this tutorial! 4 years after making it it is still of great use! (Just a little observation: If audio is set to false and the site is opened for the first time, no permission will be given regarding the audio. That also means, that no audio device (like headphones) will be listed. In your video, however, there is info in AUDIOINPUT and AUDIOOUTPUT, which means you previously gave permission to use audio. That confused me initially, because my AUDIOINPUT and AUDIOOUTPUT where empty and I thought my headphones are not recognised and started doing research. But all I had to do was setting "audio: true", reload the page, give permission to use audio - and voilá! All the info is there.)
@user-ff2et9rx5l
@user-ff2et9rx5l 4 года назад
I've always been curious how webcam websites operated. I'm still a beginner at this, so maybe I should start by just connecting to my laptop camera :D . Anyway, awesome video! Can't wait to see your other tutorials!
@akashchatterjee5179
@akashchatterjee5179 3 года назад
Thanks man... Thank you very much best wishes for you... This is the most elborative video about this topic... Please make this kind of videos.. You don't know what a big help this video was... Once again Thank you
@nilmendes7710
@nilmendes7710 3 года назад
Thank you Professor Steve, it helped me a lot!
@SemenAlexndrovich
@SemenAlexndrovich 3 года назад
Great voice, great accent. Thank you sir!
@robertbell9805
@robertbell9805 4 года назад
Excellent tutorial - very good job!
@hp7706
@hp7706 3 года назад
AMAZING tutorial. You are the man !!!
@reenezden
@reenezden 5 лет назад
You explain extremely well
@nitishkhagwal
@nitishkhagwal 2 месяца назад
This is still so useful in 2024, thanks the OG 🧡🧡
@user-bn4wn7ll3e
@user-bn4wn7ll3e 2 года назад
Very clean explaination, thank you!
@shivamshekhar8401
@shivamshekhar8401 3 года назад
Thank you so much! This was really helpful!
@peterkatsos1110
@peterkatsos1110 5 лет назад
Hi, thank you so much for the clear video! I have run into one problem and I was hoping you could help point me to the right direction. When I convert the "chunks" array into a blob and then create the videoURL via "window.URL.createObjectURL(blob)", I set the src of the video element to videoURL. However, instead of playing the video i just recorded, the video element defaults back to the webcam stream. Any thoughts as to why this would be the case? Thank you in advance!
@esabisseh
@esabisseh 3 года назад
Thank you, you give really good explanations.
@esabisseh
@esabisseh 3 года назад
You mentioned you would do a video on how to capture the saved video file to a webserver. i cant find it on your page, can you please assist?
@3asoom11
@3asoom11 4 года назад
Thanks man! That's very helpful
@albertofabbri1543
@albertofabbri1543 4 года назад
Thank you very much, really helpful!
@basselturky4027
@basselturky4027 2 года назад
That was just amazing. Thank you so much.
@jaden2478
@jaden2478 4 года назад
thanks so much this finally worked for me
@kwynintelligence435
@kwynintelligence435 5 лет назад
great stuff ... very much cool Steve !
@Abrahhhhh
@Abrahhhhh 2 года назад
Thank you very much Steve for this project I thank you my friend
@Abrahhhhh
@Abrahhhhh 2 года назад
Have been looking few days for such a nice and easy code to implement in your own project and this one is litteraly the only one that worked for me GOOD JOB STEVE
@rahibharoon5159
@rahibharoon5159 3 года назад
Steve, you are the great best video
@africanbrainchild
@africanbrainchild 4 года назад
Steve, I get met with a "Media resource blob: . . . could not be decoded, error: Error Code: NS_ERROR_DOM_MEDIA_METADATA_ERR" when clicking on the "STOP RECORDING" button for playback in the second HTML audio element. Do you perhaps have any suggestions on how to resolve this error and/or workaround it?
@Falcao_Fpv
@Falcao_Fpv 4 года назад
You saved my life
@rdawo6408
@rdawo6408 Год назад
Definitely will try this!
@jefaokpta
@jefaokpta 3 года назад
Thanks a lot by this tutorial!
@Mathematica209
@Mathematica209 3 года назад
so cool, great job
@russelldriver6394
@russelldriver6394 2 года назад
Hi Steve - Question if you don't mind. If sending a readableStream of a movie file through a pipe in node to the client browser which is then read through the resp.body.getReader and the value of each chunk is a Uint8Array. What is the best way to consolidate all of these Uint8Array chunks into 1 blob in order to create a createObjectURL in order to point the video src tag to createObjectURL href in order to stream. Hope that makes sense.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 года назад
Dealing with streams is a whole other tutorial in itself. One that I hope to find time for some day.
@codefoxx
@codefoxx Год назад
Just what I was looking for. I listen to a local radio station that plays reggae on Mondays from 12pm to 3pm. They happen to have a website where you can listen as well. I am going to create a bot that clicks the play button on the website (while I am not home) and then activate the code you showed in this video to record the three hour session. Lets see if I can put it all together. Should be fun
@codefoxx
@codefoxx Год назад
Done! but instead of JavaScript, I used Python with the following libraries: Selenium, PyAudio, and Wave. Thanks anyway!
@PritamBohra
@PritamBohra 3 года назад
Amazing video!!!!
@SachinGupta-ll5cg
@SachinGupta-ll5cg 3 года назад
Thanks sir its really helpful
@joseveliz4407
@joseveliz4407 4 года назад
Very nice video, thank you!
@clovesbacellar1340
@clovesbacellar1340 Год назад
Excelente vídeo, muito instrutivo
@vrushankamin1315
@vrushankamin1315 3 года назад
I am having this issue ,Uncaught DOMException: Failed to execute 'stop' on 'MediaRecorder': The MediaRecorder's state is 'inactive'. at HTMLButtonElement.
@davideroncuzzi2357
@davideroncuzzi2357 4 года назад
Hi Steve, can I ask you if it is possible to record multiple clips while keeping the older ones in the page? (so that you can choose the best one to download)
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
Sure. Just remember that you are holding all the clips in memory while doing that.
@Manishrj98
@Manishrj98 4 года назад
@@SteveGriffith-Prof3ssorSt3v3 thats fine is it possible?
@pramodyadeshan
@pramodyadeshan 4 года назад
it's worked.thank you!!!!!
@ramdoula506
@ramdoula506 3 года назад
i have no words thank you
@thehumanexperience7062
@thehumanexperience7062 5 лет назад
great lesson
@lakkinigoclass3113
@lakkinigoclass3113 4 года назад
Hello Sir, thank you for this very useful tutorial, but I do what you did step by step I passed all your code HTML and JS but nothing happens... the console display recording when clicking start and inactive when clicking stop but nothing happens and the recorded video doesn't appear in the second Tag why that? please help me! Sincerely.
@josuelorenzo6108
@josuelorenzo6108 4 года назад
Hi Steve, could you help me? I am working on making a web page where the user can produce sounds by touching certain keys on the keyboard, and I wanted to be able to give him the option to record the audio he generates. How can I do to record the audio that is being generated on the website specifically? I don't want it recorded from the PC microphone.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
I think this StackOverflow post will help you - stackoverflow.com/questions/40570114/is-it-possible-to-mix-multiple-audio-files-on-top-of-each-other-preferably-with
@GreenAcreFarms
@GreenAcreFarms 4 года назад
I've been reading about this for years. I'm missing something or there's absolutely no way to do this for iPhone users, is there?
@djneils100
@djneils100 3 года назад
great tutorial
@resnickhallidaysfirstborn8860
@resnickhallidaysfirstborn8860 3 года назад
Truly inspiration!
@hitech8052
@hitech8052 3 года назад
Hi Steve, Nice video and very clear steps. However I have a question around if we have a app based on vuejs, should we use this approach or vuejs libraries? What is your opinion on this?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 года назад
I don't have an opinion. Vue JS is something that is designed to be used either for parts of your site or the whole solution. It's a question of what you are comfortable doing.
@Pumazr
@Pumazr 4 года назад
Wow, great job. Im looking for something similar but the difference is that I need to record a window more specifically a Chrome Tab, do you think that can use the same approach that you use here?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
Try the Screen Capture API.
@laugilp
@laugilp 3 года назад
Hi Jose Luis! Did you finally get how to include the option to record the screen too?
@Pumazr
@Pumazr 3 года назад
Laura Gil yes i do, i already solve my problem of recording , do you need some help on that.?
@laugilp
@laugilp 3 года назад
@@Pumazr sí! Lo podemos comentar por email? gilponcelaura@gmail.com. Thanks!
@iamanishroy
@iamanishroy 4 года назад
Great Job!!
@jevon1007
@jevon1007 4 года назад
How would I be able to convert the JS to JSX for a react on rails project? Could the let variables be turned into const? And where in that code would I place the return/render? I am messing with it now, maybe I will figure it out on my own.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
It's nearly impossible for me to say how to refactor the code for a different environment without knowing the whole project. As for let vs const - as long as you never try to reassign the value for the variable, you can use const instead of let. Good luck.
@lone-eltemplodeltalento6196
@lone-eltemplodeltalento6196 2 года назад
Very good tutorial, thanks! I'm wondering if its possible to change dinamically the video/audio source? I mean, if I have 2 webcams for example or 2 microphone, make a dropdown list with the enumerateDevices function and then change the source to display one or another webcam for example? Or that cant be done without reloading the webpage? Also, can I download directly the recording without displaying it and clicking "download"? Thank you!!
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 года назад
You can change the source to the video element dynamically. Might work while recording. Not sure. Never tried to do that.
@lone-eltemplodeltalento6196
@lone-eltemplodeltalento6196 2 года назад
@@SteveGriffith-Prof3ssorSt3v3 thanks!!
@proalovutionsoccer
@proalovutionsoccer 2 года назад
pure class man
@dimovich85
@dimovich85 4 года назад
Awesome, thanks a lot!
@esorkinc4011
@esorkinc4011 5 лет назад
Steve Griffith I am using a MacBook. Eclipse/Tomcat. I have run your code and other examples across several browsers but the stream doesn't work. Access was granted to the camera. What do you think might be the problem?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 5 лет назад
Are you talking about a stream from the server?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 5 лет назад
createObjectURL recently dropped support for handling streams. That is why the code for srcObject was added on line 69.
@esorkinc4011
@esorkinc4011 5 лет назад
@@SteveGriffith-Prof3ssorSt3v3 thanks for your reply. I was referring to a stream from my PC. As a final troubleshooting step I tested the cam with a native app and it failed. From there I did a reboot, OS update and now it works fine. Is there a js Exception that could highlight such condition of the webcam not being accessible?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 5 лет назад
@@esorkinc4011 Ok. I was wondering about the server because you were talking about Tomcat. As for the JS exception - not if you are getting the device successfully. You could set up timers to wait for other video events like onloadedmetadata or ondataavailable. If they don't happen after a certain amount of time there could be an issue.
@kekuramusa
@kekuramusa 4 года назад
Hi Steve. Thanks for the great video. It seems that on chrome a least, the mediaRecorder api limits recordings to around 2 mins. Do you know of any way to increase this time limit?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
The limits for the mediaRecorder are more related to the device. The recording is stored in RAM while being recorded. File size limits for some devices can be 4GB. But storage in RAM will be much less than that.
@kekuramusa
@kekuramusa 4 года назад
@@SteveGriffith-Prof3ssorSt3v3 Ahh this makes sense. Thanks! So I'm assuming I need to find a way to save the the recording to the file storage then.
@akarshnarayan8040
@akarshnarayan8040 4 года назад
Hello steve, How would I be able to save the captured audio and video on the webpage itself as opposed to a file on the computer?Thanks.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
The only way to make it part of the webpage is to save it on the webserver. You need to use fetch( ) to upload the file from the browser and have some server-side code that accepts the file and saves it on the server.
@yashgoyal3636
@yashgoyal3636 4 года назад
@@SteveGriffith-Prof3ssorSt3v3 applying fetch in the function mediaRecorder.onstop connects php file but does'nt execute it
@yashgoyal3636
@yashgoyal3636 4 года назад
@@SteveGriffith-Prof3ssorSt3v3 and applying fetch outside it does'nt allow to upload recorded blob to server as it is not a global variable in function
@suyogbhise1935
@suyogbhise1935 4 года назад
Hey Steve! Great video. I am stuck with a problem in my application. I am trying to record a video using the webcam (WebRTC & Flask) and save it to a folder. While this works like a charm, I don't want the webcam feed to be displayed / streamed to the browser. Is it possible to just record the webcam feed and save it to the folder while disabling the browser display? Thanks!
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
You don't have to load the Stream from the user's webcam into the video element if you don't want to. You can skip that part of the code if you want. Not sure why you wouldn't want the user to see what they are recording but you can. Or you can use CSS to toggle the display of the video element.
@suyogbhise1935
@suyogbhise1935 4 года назад
@@SteveGriffith-Prof3ssorSt3v3 Thanks Steve! That worked! I am creating an application that tracks user expressions while they do tasks on the web, after taking their consent.
@shawnshaw9859
@shawnshaw9859 Год назад
Great video! what about the size limit of chunk? can I record for one hour? should filesystem-api of indexdb used to store a large size video mp4 file?
@SteveGriffith-Prof3ssorSt3v3
The size limit depends on the browser and the device being used plus the available memory to hold your recording. IndexedDB is not for storing files. You could use the filesystem api if you wanted to save it locally.
@thomasbugg7645
@thomasbugg7645 4 года назад
Thanks so much for this tutorial, it was just what I needed. I'm also trying to save the video to a database for my current project, what was the name of the video in which you mention sending the video to a server?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-JtKIcqZdLLM.html
@charujain585
@charujain585 2 года назад
Is there any way that enumeratedevices method returns null even if device has camera. Need this for testing an application
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 года назад
That is definitely a possibility
@thomasandre-lubin3899
@thomasandre-lubin3899 4 года назад
Thanks for your video !
@thomasandre-lubin3899
@thomasandre-lubin3899 4 года назад
I realized when I open the file downloaded (I recorded audio and video) there a black screen with sound. I use video/mp4 as in your video. Have you got any clue on this ?
@melik-alexandrefarhat2185
@melik-alexandrefarhat2185 4 года назад
Hello Steve, so when I download the file, it does generate a name with .mp4 extension. But when i try to play that downloaded file (Im on a mac), quicktime (10.4) cannot play it. It tries to "convert" it and fails. First why does QT wants to convert it ? I mean I can open other .mp4 on my system without QT trying to convert it. Second, would you know how I can play the downloaded .mp4 in QT ? I've also tried with { 'type' : 'video/quicktime;' } and { 'type' : 'video/H264;' }..... none works...TTHHXX!!
@prog_ramming_brains
@prog_ramming_brains 2 года назад
Thank you so much.How do i show the time elapsed in progress bar after downloading the video.Please help
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 года назад
I have other videos about video control in JS. Here is one - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-DcWsUyhBykE.html
@ScreenPrintR
@ScreenPrintR 4 года назад
Thank you for your Video. On line 40 and several other lines you have {...} etc. etc. How did you put those dots in? Is it done with the IDE you're using? Thank you in advance.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
It has to do with the code folding. When you use the arrows over on the left edge, it collapses the section and shows ... for the part that it collapsed. This video was in Brackets. Currently I use VSCode and it does the same thing.
@ScreenPrintR
@ScreenPrintR 4 года назад
So do you have a link to the full code?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
@@ScreenPrintR the link is in the description for nearly all my videos.
@mikoscreative8324
@mikoscreative8324 5 лет назад
my website is on squarespace and it looks like i can only install the javascript files I need to for videojs and record videojs one at a time. when i downloaded the zip while trying to understand how to put this functionality on my site, there are a ton of files in the zip. is there a way for me to enable my site visitors to capture a video and that video recording be saved into a google drive folder? because of the way squarespace is set up, i'm thinking I'm gonna need a 3rd party app to do all the work for me (aside from the fact that I dont know what I'm doing) otherwise every file needed would have to be linked in a really convoluted way through squarespace.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 5 лет назад
I don't have much experience with SquareSpace and their environment. However, you can create the files as I have shown in this video, and then use the Google Drive API to upload a file. developers.google.com/drive/api/v3/manage-uploads SquareSpace and what they allow or prevent is the unknown here.
@prajwalrajbasnet9019
@prajwalrajbasnet9019 3 года назад
Hey can we save the recorded audio in similar way? I found no options for audio encoding in plain javascript
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 года назад
The constraint options object lets you define what you want to save. You can connect with an audio element instead of a video element as the output. Then you create the Blob with the correct media type. Pretty much the same as the video... HOWEVER, browser support is limited. Capture from the HTML media elements - caniuse.com/#feat=mediacapture-fromelement Capture with MediaRecorder API - caniuse.com/#feat=mediarecorder You will see that Safari is quite limited and iOS Safari even more limited.
@jeffreylee6878
@jeffreylee6878 2 года назад
Thx for the video
@weitanglau162
@weitanglau162 4 года назад
Hi steve, will recording of audio only works on phone too? And is there a better way to do this on reactjs?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
Audio and video work the same places. React doesn't change anything. Someone has probably written a component for it though
@weitanglau162
@weitanglau162 4 года назад
@@SteveGriffith-Prof3ssorSt3v3 Thanks for your reply Steve. I have tried looking for a component that is similar to WhatsApp's implementation, but I'm unable to find one
@franciscogaxiola9450
@franciscogaxiola9450 4 года назад
Hey, how can I build a plugin to ask desktop record permission? Just like zoom does to share screen in real time, and how to create a native app that lets reate layers to that video streaming in order to create pointers, vectors, annotations, etc? In general terms a guidance, not in detail, I just want to know where to start learning.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
Start with the screen capture API - developer.mozilla.org/en-US/docs/Web/API/Screen_Capture_API
@redfoothedude3350
@redfoothedude3350 5 лет назад
get tut!.... mobile browsers are my target... works on ios safari but it doesn't save...i think auto play on mobile browsers is not allowed and when you push play the video goes full screen and you can't hit record button... but i have a guess that ios won't allow you to save the blob in the browser like a laptop. Any thoughts on this?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 5 лет назад
iOS is very restrictive with things like media. Apple wants everyone to go through iTunes so they can collect their $$. The autoplay is something that most browsers have restricted recently.
@michaelmudge3080
@michaelmudge3080 5 лет назад
Hey Steve, First off, great video! My question is... in the video you mentioned that in a later video you would get into how to send the saved video (Blob object I think) through to the server. Did you ever make a video explaining that? I've browsed through your video list but wasn't able to find anything. Thanks!
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 5 лет назад
I did a video recently about working with video elements and the canvas element. I showed how to get an image as a blob from the canvas and then a little mention about using fetch. I have a video about uploading files with fetch. I dont have the exact thing you are talking about but most of the info is in those two videos. I will be doing some more videos in the next couple months that will be related too
@polburkardtfreire1162
@polburkardtfreire1162 5 лет назад
Hey Michael, have you found a way to pass the media file to server? I'm facing the same problem here. Thanks in advanced!
@angshu7589
@angshu7589 4 года назад
@@polburkardtfreire1162 I tried it with a audio file and I converted the blob to an arrayBuffer to a Uint8Array to an Array. I posted that data and had to go to the server (Node.js) where I converted the Array to a Uint8Array to an arrayBuffer to a buffer, and saved that in a file, and surprisingly enough, it worked.
@anshulmanapure1980
@anshulmanapure1980 Год назад
@@angshu7589 do you have some related tut on this?
@pettie9349
@pettie9349 4 года назад
How to send a servletrequest from this html page to save the video in oracle, i mean where should i add so that i can save it in database, anyone please help me
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
You don't need a form element to send things to a server side script. You can create an HTTP Request using fetch( ). Then use a FormData object to store whatever elements you want to put in the body of the Request object. I have playlist about AJAX and fetch if you don't know how that works. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-7EKebb4VUYQ.html
@johndev4845
@johndev4845 2 года назад
Hello Sir, If we want to play "user uploaded mp3 file " while recording video and after recording a video, can video be played with that music? Please answer.i need your help
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 года назад
Are you talking about combining external audio with a video as it is being recorded? or after it is recorded? I've never tried to do either. You probably want to look at the Web Audio API that can be used for combining audio channels. developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API
@Lan_man2273
@Lan_man2273 2 года назад
Hello! This video was amazing and informative. I was wondering if it is possible to have the recording played in the same frame as the one initially recording the video?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 года назад
If you mean in the same video element then yes. Just set the video element's source to what you recorded.
@Lan_man2273
@Lan_man2273 2 года назад
@@SteveGriffith-Prof3ssorSt3v3 Would that essentially just be "" based on your code is in this video (where we set the src as the id of the video being saved by "let vidSave = document.getElementById('vid2');" However I run into a type error. I also tried setting the id to "vid2" however it had no playback after stopping the recording.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 года назад
@@Lan_man2273 The src has to point to a URL. you need the one created with createObjectURL
@brunojerkovic4266
@brunojerkovic4266 4 года назад
How can I have multiple streams in one Media Recorder instance(I want to record a web conference call)?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
A MediaRecorder instance is a stream. If you want multiple streams then you need multiple MediaRecorder instances.
@mkrishnacharan
@mkrishnacharan 4 года назад
Hi Steve.... Excellent I am also working on something similar to this... I would like to send continous stream of audio to the python API for speech to text. I am calling the mediaRecorder.requestData() to get fire the ondataavailable event.... Can you please share your thoughts on this kind of approach to send the continous speech stream to API
@jacobtilley5918
@jacobtilley5918 3 года назад
Great video, very helpful! I just subscribed (: I built something similar and it is working, but there is no option to download the recorded video in my project. Which specific code was responsible for that?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 года назад
The code inside the stop event handler function.
@zackgrey4472
@zackgrey4472 2 года назад
Does anyone know if its possible to record system audio, not from another web browser nor from a microphone, but say from an application like Spotify?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 года назад
Not consistently across all browsers. But it sounds like you are looking for the screen capture API
@zackgrey4472
@zackgrey4472 2 года назад
@@SteveGriffith-Prof3ssorSt3v3 Thank you!
@CHARLIEKCHARLIEK
@CHARLIEKCHARLIEK 4 года назад
Hi Steve! Great video, is there anyway that the audio could be sent to the owner of the website? or to a Google Drive or Dropbox account ? For interviews etc, thanks :)
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
You can use fetch to upload a file. Or if you have serverside script you can use webrtc to stream to the server
@CHARLIEKCHARLIEK
@CHARLIEKCHARLIEK 4 года назад
@@SteveGriffith-Prof3ssorSt3v3 thank you very much !
@samehmohamed3729
@samehmohamed3729 4 года назад
Hey Steve, great tutorial! I have a project to build something similar to team viewer/Remote PC application. Any ideas using javascript or so? thank you
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
Have you looked at the screen capture api?
@samehmohamed3729
@samehmohamed3729 4 года назад
@@SteveGriffith-Prof3ssorSt3v3 developer.mozilla.org/en-US/docs/Web/API/Screen_Capture_API yes i looked at this, but Im new to JS and i dont really understand how to implement it, is it only for browsers? or can I try it on something like VS code?
@jimkom4284
@jimkom4284 3 года назад
Is there any way to capture and record the system audio (not the input from the microphone)?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 года назад
HTML5 Screen Capture API - developer.mozilla.org/en-US/docs/Web/API/Screen_Capture_API But it doesn't work on all browsers or OS.
@cheikhsow6199
@cheikhsow6199 3 года назад
good job
@BeatBustersDance
@BeatBustersDance Месяц назад
Hi Steve, I have a video calling application where I want to record audio + screen share of each participant. How can I do that. Can we combine streams
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 Месяц назад
Have a look at the screen capture API - developer.mozilla.org/en-US/docs/Web/API/Screen_Capture_API And the WebRTC API - developer.mozilla.org/en-US/docs/Web/API/WebRTC_API One of those will likely meet your needs.
@ruchiyadav7015
@ruchiyadav7015 4 года назад
Can you help me with an issues, as it's not working on iOS safari browser on device.also on Mac safari it's working as an experimental feature
@ruchiyadav7015
@ruchiyadav7015 4 года назад
Thanks in advance
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
Apple is very resistant to making web features available that they want to keep as native so they can force developers to go through the App Store.
@stevabebic
@stevabebic 4 года назад
Hey Steve, we implemented similar thing within our product, but we are stuck with Safari/Chrome on iOS, it doesnt work and there is no alternative we are aware of. Do you have any experience with iOS and MediaStream Recording API?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
WebRTC has only been supported on iOS for the last year and a half with Safari 11. If you are using anything older then you are stuck with using Native. Using multiple tracks has just very recently had support added with Safari 13. Apple always seems to be dragging their heels with supporting things like media and Progressive Web Apps - basically anything on the web that will be replacing native functionality and threaten people having to go through the App Store. You can use caniuse.com/ to see which specific features are supported starting at what point.
@stevabebic
@stevabebic 4 года назад
@@SteveGriffith-Prof3ssorSt3v3 We tried to use Media Stream Recording API, we even tried to turn on Experimental Feature under Safari 13, but no luck...Native is our last resort, but wanted to check if maybe there is something i was not aware of that we can use to make current solution work. WebRTC is very complex for the solution we need to implement and there is always need for third party server for recording video (since we need recorded video to store it in Azure).
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
@@stevabebic sorry I couldn't help you more
@revanslacey
@revanslacey Год назад
@@stevabebic The recording seems to be working for me now on Safari. The problem I'm experiencing is that files recorded in Chrome don't pay on Firefox or Safari. Firefox recorded files play everywhere, Safari files play everywhere but seem to sound worse, it asks for camera permissions every time the page loads, and also the thumbnail capture I'm using doesn't work there. It's certainly not easy to get what seems like relatively simple functionality to work consistently!
@bhasim4299
@bhasim4299 Год назад
Man 10/10 Video
@ambientsoda106
@ambientsoda106 3 года назад
So will this work a hosted website abs a camera on your home net work.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 года назад
The script needs to run on the same computer as the webcam.
@tylermcrill3290
@tylermcrill3290 4 года назад
Hello! First I want to say great video, because of this video I have recording up and running. However, I have encountered an audio bug that I was wondering if you ever dealt with. Whenever I enable audio and record a video, I am met with an ear piercing screeching sound along with the audio in the video. I don't believe it's my laptop, seeing as it is only a month old. Any feedback would be appreciated!
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
Sorry. I haven't encountered that problem.
@abusalem411
@abusalem411 5 лет назад
Hi, excellent tutorial! How can I make the audio work? If I set true, it makes a terrible noise on my laptop. How can I fix it? I think, the mediastream is going through the speaker, how do I disconnect it?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 5 лет назад
You need to mute the Video element which is playing back the audio and video.
@Falcao_Fpv
@Falcao_Fpv 4 года назад
please steve, how can i mute de video element?
@abdelrahmanmagdy8946
@abdelrahmanmagdy8946 4 года назад
amazing
@user-eu9vb8dw2p
@user-eu9vb8dw2p Месяц назад
Hey,I want to record and save the streaming from a given url, how to do that?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 Месяц назад
Sorry. I don't have a tutorial on doing that.
@GhirMohcine
@GhirMohcine 4 года назад
How can we make it when we click download, to save it directly in a directory into the server ?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
You cant save directly to a folder on a server. You can use fetch to upload a file but there needs to be a script on the server that accepts the fetch and then decides if and where to save it.
@crashvid1633
@crashvid1633 2 года назад
How can we use Mediarecorder to record HTML CANVAS ( animation ) element and download in High Quality video ?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 2 года назад
Use the screencapture api
@kshan2k186
@kshan2k186 4 года назад
Great video steve... Is it supported in mobile devices as well?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
As long as you are talking about fairly new mobile devices yes. - caniuse.com/#feat=stream
@kshan2k186
@kshan2k186 4 года назад
@@SteveGriffith-Prof3ssorSt3v3 Thank you...
@Xerox482
@Xerox482 3 года назад
Is there anyway we can send these audio video incoming data directly to server and write it video file on server ?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 года назад
You can use fetch to upload the Blob that is created in the mediaRecorder.onstop function. Here is video about uploading files with fetch - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-JtKIcqZdLLM.html
@Xerox482
@Xerox482 3 года назад
@@SteveGriffith-Prof3ssorSt3v3 right but that is only possible with onstop function , anyway to get live video blob as it arrive from camera and we sent it to server to create live stream effect , calling on stop repeatedly i think is not good idea
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 года назад
@@Xerox482 if you want to stream then you need to use the webRTC api
@ruchiyadav7015
@ruchiyadav7015 4 года назад
Hey, great video.. really helpfull, thanks a ton. Just a query here, will this work for mobile devices as well?
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 4 года назад
It all depends on which device and which version of the OS - caniuse.com/#search=mediastream
@ruchiyadav7015
@ruchiyadav7015 4 года назад
@@SteveGriffith-Prof3ssorSt3v3 I am working on ionic pwa app, in that I will be using this video recording feature, this code works for web, but it's not working on device. I am checking on chrome for android version 81 only
@akanarchygaming2414
@akanarchygaming2414 5 лет назад
Hey Steve, Watched this video and it has helped me a lot. I'm trying to create a web application for a photobooth project I'm working on, I was wondering if there was any way that once a user stopped recording the photo/video would save directly to a localhost file ready for rename/editing on the spot and how long it may take obviously dependant on the file size. I'm working with DSLR Cameras converted to webcams and think this would be a perfect workaround from the crappy software I'm currently using.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 5 лет назад
You can't force a file to save on the person's computer. That would be a huge security risk. The best thing you can do is display an anchor to the file that was generated locally. Then the user is the one initiating the save of the file.
@akanarchygaming2414
@akanarchygaming2414 5 лет назад
@@SteveGriffith-Prof3ssorSt3v3 Not even on my own system? it's not going to be deployed onto other systems just my local machine / localhost network. Any examples of a displayed anchor because I'm not sure how to further extract the blob and saving requires me to watch the entire recording before download.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 5 лет назад
@@akanarchygaming2414 It doesn't matter whose computer it is. Browsers will not allow a file download to happen without user interaction. You don't need to show the downloaded file or play it though. See on line 72 where I am setting the source of the second video to the value returned by createObjectURL? That would be the source of the href attribute in the anchor tag that you create. If you add the download attribute to the anchor tag as well it will force the download instead of trying to load the href in the browser. DOWNLOAD VIDEO
@akanarchygaming2414
@akanarchygaming2414 5 лет назад
@@SteveGriffith-Prof3ssorSt3v3 Wouldn't the value be the blob in that case? I'm trying this now and it just seems to download a file called download.txt which says it's not available.
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 5 лет назад
I'm working on a new sample for you with the functionality.
@dhruvvagadiya5936
@dhruvvagadiya5936 3 года назад
hello vrother I hope You see this, I have to use camera in my project , but the camera should be responsive to mobile size, i have been trying it,but the video either stretches, or is only half of the screen, help me,
@SteveGriffith-Prof3ssorSt3v3
@SteveGriffith-Prof3ssorSt3v3 3 года назад
Sounds like you are setting both a height and width on the video element. If you want it to be responsive leave the height as auto
@dhruvvagadiya5936
@dhruvvagadiya5936 3 года назад
@@SteveGriffith-Prof3ssorSt3v3 well se if we do that than ony half screen video will be captured, How do we Get 9:16 style video output
Далее
HTML5 FullScreen API
8:07
Просмотров 7 тыс.
Record Your MIC with JavaScript
13:59
Просмотров 6 тыс.
мое новое шоу «блеф»
00:40
Просмотров 46 тыс.
You might not need useEffect() ...
21:45
Просмотров 144 тыс.
Capturing Media from HTML on Mobile Devices
9:41
Просмотров 39 тыс.
The Dangers Of Promise.all()
6:15
Просмотров 65 тыс.
How to Use the New JS Object GroupBy Method
18:17
Просмотров 2,9 тыс.
How To Record Video With JavaScript
7:32
Просмотров 11 тыс.
How to test a local website on your phone
7:48
Просмотров 379 тыс.
JavaScript Audio CRASH COURSE For Beginners
1:04:45
Просмотров 82 тыс.