tap

F1: Ferrari's Sainz wins in Mexico; Verstappen 6th

The win was a first for Ferrari in Mexico since 1990 and fourth of Carlos Sainz's career.





tap

The Krishna metaphor

Natyarangam’s annual thematic fest for young dancers opens today. Chitra Swaminathan on its multi-disciplinary approach.




tap

Meandering : art, ecology, and metaphysics / edited by Sofia Lemos.

London : Sternberg Press ; Madrid : Fundación TBA21, [2024]




tap

Tech Support - Sneaker Expert Jeff Staple Answers Sneaker Questions From Twitter

Renowned sneaker expert and designer Jeff Staple answers your sneaker-centric questions from Twitter.




tap

World’s smallest tape recorder built from bacteria

Mr. Wang and his team created the microscopic data recorder by taking advantage of CRISPR-Cas, an immune system in many species of bacteria.




tap

‘Tap South India’ is PVR INOX mantra for growth

South contributes 35 per cent to the PVR INOX box office, says Executive Director Sanjeev Kumar Bijli




tap

Labour pain: Sitapur’s maternity racket

Ground report: The struggle to access to quality, affordable care for pregnant.



  • Policy & Issues

tap

The police tapes (1976) / directed by Alan Raymond & Susan Raymond [DVD].

[New York] : New Video Group, [2006]




tap

Former BRS MLA ‘skips’ police questioning in phone tapping case




tap

'Stall Speed' and 'Escape Velocity': Empty Metaphors or Empirical Realities? [electronic journal].




tap

Choked By Red Tape? The Political Economy of Wasteful Trade Barriers [electronic journal].

National Bureau of Economic Research




tap

ICRIER study explores untapped potential of India’s turmeric sector

Offers roadmap as the country dominates the global market with 70% market share




tap

Government schemes catapulting India to become developed nation: Amit Shah

Modi government has ended “policy paralysis” and transformed India into an economic bright spot, says Union Home Minister Amit Shah




tap

A simple and rapid colorimetric detection of Staphylococcus Aureus relied on the distance-dependent optical properties of silver nanoparticles

Anal. Methods, 2024, Accepted Manuscript
DOI: 10.1039/D3AY02189K, Paper
Ngoc Anh Thu Phan, Hoang Men Nguyen, Cam Duyen Thi Vo, Toi Vo Van, Phuoc Long Truong
The quick and accurate diagnosis of pathogens has appeared as a pressing issue in clinical diagnostics, environmental monitoring, and food safety. The current assays are suffering from limited capacities in...
The content of this RSS Feed (c) The Royal Society of Chemistry




tap

Design, synthesis, and biological evaluation of pyrazole–ciprofloxacin hybrids as antibacterial and antibiofilm agents against Staphylococcus aureus

RSC Med. Chem., 2024, Advance Article
DOI: 10.1039/D4MD00623B, Research Article
Ojaswitha Ommi, Priyanka Sudhir Dhopat, Shashikanta Sau, Madhu Rekha Estharla, Srinivas Nanduri, Nitin Pal Kalia, Venkata Madhavi Yaddanapudi
A series of pyrazole–ciprofloxacin hybrids were designed, synthesized, and tested for antibacterial activity against Staphylococcus aureus, Pseudomonas aeruginosa, and Mycobacterium tuberculosis, aiming to combat antibiotic resistance.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




tap

601: Brad Frost on A Global Design System + Frostapalooza

Brad Frost has got design systems on his mind—at a global scale. What is a global design system? Are two design systems ever the same? How would this slot inside atomic design? What has been the response from the web community to global design system as an idea? And what's Frostapalooza?




tap

630: Frostapalooza Recap, Follow Up, and Messy Codebases

Chris has a birthday today 🎉, we recap our Frostapalooza experience celebrating Brad Frost's birthday, do all codebases become a mess, Mermaid, TLDraw, and Figjam thoughts, making tiny games, where's the follow up in web and world news, and what's the current state of CMS' on the web?




tap

F1: Verstappen pulls off stunning win

Red Bull's Max Verstappen dealt Lando Norris a shattering blow in their Formula One title battle by winning a wet and chaotic Sao Paulo Grand Prix from 17th on the grid.




tap

Eyebrows raised as Central team visits Anantapur to assess rabi drought during rainy kharif

The team choosing mandals like Vidapanakallu and Vajrakarur which received excessive rain in June, draws flak from farmers and district officials alike; farmers worry as to how to present their drought woes to the officials who are visiting their fields which are now rain-fed and green




tap

Anantapur Collector urges farmers to adopt natural practices

V. Vinod Kumar visits several watershed structures in the district implemented by Accion Fraterna Ecology Centre with funding from NABARD




tap

Building a Dictaphone Using Media Recorder and getUserMedia

Chris Mills brushes up his shorthand and shows how the MediaStream Recording API in modern browsers can be used to capture audio directly from the user’s device. Inching ever closer to the capabilities of native software, it truly is an exciting time to be a web developer.


The MediaStream Recording API makes it easy to record audio and/or video streams. When used with MediaDevices.getUserMedia(), it provides an easy way to record media from the user’s input devices and instantly use the result in web apps. This article shows how to use these technologies to create a fun dictaphone app.

A sample application: Web Dictaphone

To demonstrate basic usage of the MediaRecorder API, we have built a web-based dictaphone. It allows you to record snippets of audio and then play them back. It even gives you a visualisation of your device’s sound input, using the Web Audio API. We’ll just concentrate on the recording and playback functionality in this article, for brevity’s sake.

You can see this demo running live, or grab the source code on GitHub. This has pretty good support on modern desktop browsers, but pretty patchy support on mobile browsers currently.

Basic app setup

To grab the media stream we want to capture, we use getUserMedia(). We then use the MediaRecorder API to record the stream, and output each recorded snippet into the source of a generated <audio> element so it can be played back.

We’ll first declare some variables for the record and stop buttons, and the <article> that will contain the generated audio players:

const record = document.querySelector('.record');
const stop = document.querySelector('.stop');
const soundClips = document.querySelector('.sound-clips');

Next, we set up the basic getUserMedia structure:

if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
   console.log('getUserMedia supported.');
   navigator.mediaDevices.getUserMedia (
      // constraints - only audio needed for this app
      {
         audio: true
      })

      // Success callback
      .then(function(stream) {

      })

      // Error callback
      .catch(function(err) {
         console.log('The following `getUserMedia` error occured: ' + err);
      }
   );
} else {
   console.log('getUserMedia not supported on your browser!');
}

The whole thing is wrapped in a test that checks whether getUserMedia is supported before running anything else. Next, we call getUserMedia() and inside it define:

  • The constraints: Only audio is to be captured for our dictaphone.
  • The success callback: This code is run once the getUserMedia call has been completed successfully.
  • The error/failure callback: The code is run if the getUserMedia call fails for whatever reason.

Note: All of the code below is found inside the getUserMedia success callback in the finished version.

Capturing the media stream

Once getUserMedia has created a media stream successfully, you create a new Media Recorder instance with the MediaRecorder() constructor and pass it the stream directly. This is your entry point into using the MediaRecorder API — the stream is now ready to be captured into a <Blob>, in the default encoding format of your browser.

const mediaRecorder = new MediaRecorder(stream);

There are a series of methods available in the MediaRecorder interface that allow you to control recording of the media stream; in Web Dictaphone we just make use of two, and listen to some events. First of all, MediaRecorder.start() is used to start recording the stream once the record button is pressed:

record.onclick = function() {
  mediaRecorder.start();
  console.log(mediaRecorder.state);
  console.log("recorder started");
  record.style.background = "red";
  record.style.color = "black";
}

When the MediaRecorder is recording, the MediaRecorder.state property will return a value of “recording”.

As recording progresses, we need to collect the audio data. We register an event handler to do this using mediaRecorder.ondataavailable:

let chunks = [];

mediaRecorder.ondataavailable = function(e) {
  chunks.push(e.data);
}

Last, we use the MediaRecorder.stop() method to stop the recording when the stop button is pressed, and finalize the Blob ready for use somewhere else in our application.

stop.onclick = function() {
  mediaRecorder.stop();
  console.log(mediaRecorder.state);
  console.log("recorder stopped");
  record.style.background = "";
  record.style.color = "";
}

Note that the recording may also stop naturally if the media stream ends (e.g. if you were grabbing a song track and the track ended, or the user stopped sharing their microphone).

Grabbing and using the blob

When recording has stopped, the state property returns a value of “inactive”, and a stop event is fired. We register an event handler for this using mediaRecorder.onstop, and construct our blob there from all the chunks we have received:

mediaRecorder.onstop = function(e) {
  console.log("recorder stopped");

  const clipName = prompt('Enter a name for your sound clip');

  const clipContainer = document.createElement('article');
  const clipLabel = document.createElement('p');
  const audio = document.createElement('audio');
  const deleteButton = document.createElement('button');

  clipContainer.classList.add('clip');
  audio.setAttribute('controls', '');
  deleteButton.innerHTML = "Delete";
  clipLabel.innerHTML = clipName;

  clipContainer.appendChild(audio);
  clipContainer.appendChild(clipLabel);
  clipContainer.appendChild(deleteButton);
  soundClips.appendChild(clipContainer);

  const blob = new Blob(chunks, { 'type' : 'audio/ogg; codecs=opus' });
  chunks = [];
  const audioURL = window.URL.createObjectURL(blob);
  audio.src = audioURL;

  deleteButton.onclick = function(e) {
    let evtTgt = e.target;
    evtTgt.parentNode.parentNode.removeChild(evtTgt.parentNode);
  }
}

Let’s go through the above code and look at what’s happening.

First, we display a prompt asking the user to name their clip.

Next, we create an HTML structure like the following, inserting it into our clip container, which is an <article> element.

<article class="clip">
  <audio controls></audio>
  <p>_your clip name_</p>
  <button>Delete</button>
</article>

After that, we create a combined Blob out of the recorded audio chunks, and create an object URL pointing to it, using window.URL.createObjectURL(blob). We then set the value of the <audio> element’s src attribute to the object URL, so that when the play button is pressed on the audio player, it will play the Blob.

Finally, we set an onclick handler on the delete button to be a function that deletes the whole clip HTML structure.

So that’s basically it — we have a rough and ready dictaphone. Have fun recording those Christmas jingles! As a reminder, you can find the source code, and see it running live, on the MDN GitHub.


This article is based on Using the MediaStream Recording API by Mozilla Contributors, and is licensed under CC-BY-SA 2.5.


About the author

Chris Mills manages the MDN web docs writers’ team at Mozilla, which involves spreadsheets, meetings, writing docs and demos about open web technologies, and occasional tech talks at conferences and universities. He used to work for Opera and W3C, and enjoys playing heavy metal drums and drinking good beer.

More articles by Chris




tap

Don’t see tapering of deposit rates in near term, Canara Bank MD says

Bank prepared for Canara Robeco listing in Q4



  • Money &amp; Banking

tap

TDP leaders from Anantapur disappointed after being snubbed for nominated posts

Having swept all 14 Assembly seats and two MP seats in the undivided district, there were several contenders from the TDP and JSP for the nominated posts




tap

Youth from Anantapur invited for We are Together International Prize of Russia

The prize is +awarded annually to citizens and organizations regardless of their country of residence, nationality, gender




tap

Anantapur enforcement dirve: police register over 3,000 cases against violators of Motor Vehicle Act

In the drive conducted over one week, police register 12 cases against gambling dens, arrest 59 persons and seize more than ₹1.91 lakh cash, says SP P. Jagadeesh




tap

Karnataka’s untapped tourism potential

The State has not capitalised on its rich cultural, religious, and natural heritage




tap

As its industry struggles, Germany services sector offers untapped growth potential




tap

TAPMI inducts second batch of Integrated Management Programme

The batch has students from various streams, with 52.2% coming from the science stream, 40.3% from the commerce stream, and 7.5% from arts and humanities




tap

My contest is against Lalu Prasad not Rohini, says Rajiv Pratap Rudy

BJP leaders earlier mocked Rohini Acharya by calling her Singaporean Bahu because she stays in Singapore with her husband and three children



  • Lok Sabha Elections

tap

Tapping into knowledge economy

Quizmaster Giri ‘Pickbrain’ Balasubramaniam says there’s a lot of scope for the quizzing market




tap

A well-woven tapestry

‘Maniyosai’ recounted Palghat Mani Iyer’s musical journey. Suganthy Krishnamachari writes




tap

'There was so much warmth about Pratap Pothen'

'I will always remember him for his innocent smile, twinkling eyes, and kind words.'




tap

Celsius Therapeutics launches to tap single-cell genomics for drug discovery




tap

Changes on tap at U.S. Chemical Safety Board

Chair departs, investigators leave, staff fears changing mission




tap

BASF taps Citrine for artificial intelligence




tap

Lundbeck taps former Millennium chief as CEO




tap

Changes on tap at U.S. Chemical Safety Board

Chair departs, investigators leave, staff fears changing mission




tap

Cool Warner catapults Sunrisers to IPL Final

SRH were pegged back by wickets at every stage, but David Warner stayed tenacious, unleashing shots at will to chase down 163 with 4 wickets to spare.



  • Indian Premier League

tap

Maharashtra Assembly polls: Congress shows confidence in sitting legislators Dhangekar, Thopte and Jagtap




tap

Recipe: Divya's Tapioca Stir Fry

Here's a simple recipe or breakfast or as an evening snack at home.




tap

Pratap Bhanu Mehta writes: India’s economic credibility challenge




tap

Pratap Bhanu Mehta writes: In government and outside, Bibek Debroy remained his own person




tap

Pratap Bhanu Mehta writes: D Y Chandrachud, a Chief Justice of his time




tap

Lockdown diary: 'There's a gran isolating in a tree communicating by catapult!'

Like man buns on scooters and ukulele busking, Covid-19 has now spread to the north from London – inspiring a coronavirus soapcom from our self-isolating comedy-writer

Up here in the north-west, we’re used to living in the slipstream of London’s sleek urban shenanigans. Whatever the cultural breakthrough – man buns on scooters, cashless ukulele busking, emotional support bees – it takes a while to reach the Lancaster and Morecambe Non-Metropolitan Area. If it ever does.

A Street Stranger Watch leads to a death and the appearance at midnight of the street’s original Victorian inhabitants

Continue reading...




tap

Viraataparvam First Look Out: Sai Pallavi Looks Intense As She Waits Beside A Memorial In The Forest

Sai Pallavi's first look poster from Viraataparvam is finally out on the occasion of her birthday. The director of the thriller movie, Venu Udugula took to his social media handle to unveil the intriguing first look poster of the actress. {image-exi59ufwoaa4r2s-1589007113.jpg




tap

The Nickstape




tap

Post-Fukushima Japan Taps Coal Over Renewables

Prime Minister Shinzo Abe is pushing Japan’s coal industry to expand sales at home and abroad, undermining hopes among environmentalists that he’d use the Fukushima nuclear accident to switch the nation to renewables.




tap

HR e-briefing - 497 Red tape cuts

The Department for Business, Innovation and Skills (BIS) has revealed that the right to request flexible work arrangements will not be extended to parents of 17 year olds in April as previously announced. Contrary to some reports, the existing law p...




tap

Pratapgarh: शादी टूटी तो युवक ने फांसी लगाकर दे दी जान

परिवार के लोगों से विवाद के बाद पहुंची थी पुलिस