Posts

Showing posts with the label javascript

How to add minutes in javascript date object

Image
  This code snippet you can use to add or subtract minute from JavaScript date object  function   addMinute ( date ,   min )   {      let   nD  =  new   Date ( date . getTime () +  min  *  6e4 )      return   nD ; } To add minutes call addMinute method and pass date param in which you want to add the minutes      let   date  =  new   Date () ;      addMinute ( date ,   5 ) To subtract the minute use this method as demonstrate below      let   date  =  new   Date () ;      addMinute ( date ,  - 5 ) Output:

how to access video and audio stream on web using webRTC

Image
 Hi, reader in this blog you gonna read how to access video and audio stream using JavaScript. we will cover up this tutorial with code snippet and explanation  We will use navigator object that provide access to your hardware equipment  like media devices , bluetooth , geolocation etc.. We will focus on accessing camera. Perquisites:  - Camera and Mic - Browser with JavaScript support Lets start let   stream  =  await   navigator . mediaDevices . getUserMedia ( {              video :   true ,              audio :   true ,          } ) ; console . log ( 'stream' ,   stream ) //html side //  <video   id = " cam " ></video> //To bind this stream with html let   videoNode  =  document . getElementById ( 'cam' ) ;     ...

Complete Reactive Form Angular

Image
  In this tutorial we going to learn how to use angular reactive form in our angular application  reactive form is really amazing and has many feature and good code maintains approach and increase development work fast. How to import angular reactive form in our application  1. In app.module.ts file import reactive module in imports array of ngModule decorator. this will me reactive module available to your project if you have modular approach then import this on module level of specific feature Let's start create and example and start using reactive form  In this example we will coverup all necessary input fields in a web form and validations - input  - checkbox Demo Import the Reactive forms Module in angular app.module.ts import   {   ReactiveFormsModule   }   from   '@angular/forms' ; @ NgModule ( {    imports :  [      ReactiveFormsModule   ] , } ) export   class   AppModule ...