eco

Ecological rationality in spatial planning: concepts and tools for sustainable land-use decisions / Carlo Rega

Online Resource




eco

Ecology, conservation, and restoration of Chilika Lagoon, India C. Max Finlayson, Gurdeep Rastogi, Deepak R. Mishra, Ajit K. Pattnaik, editors

Online Resource




eco

Ocean recovery: a sustainable future for global fisheries? / Ray Hilborn and Ulrike Hilborn

Dewey Library - SH329.S87 H55 2019




eco

Stewarding the sound: the challenge of managing sensitive coastal ecosystems / editors, Leah Bendell, professor, Biological Sciences, Simon Fraser University, Burnaby BC, Canada, [and three others]

Rotch Library - QH106.2.B8 S745 2019




eco

Tropical ecosystems in Australia: responses to a changing world / Dilwyn J. Griffiths

Online Resource




eco

Socio-economic and eco-biological dimensions in resource use and conservation: strategies for sustainability / Niranjan Roy, Shubhadeep Roychoudhury, Sunil Nautiyal, Sunil K. Agarwal, Sangeeta Baksi, editors

Online Resource




eco

Reconciling human needs and conserving biodiversity: large landscapes as a new conservation paradigm: The Lake Tumba, Democratic Republic of Congo / Bila-Isia Inogwabini

Online Resource




eco

Ecological models / Jay Odenbaugh

Dewey Library - QH541.15.M3 O44 2019




eco

Plant-Fire Interactions: Applying Ecophysiology to Wildfire Management / Victor Resco de Dios

Online Resource




eco

Sustainable Food Chains and Ecosystems: Cooperative Approaches for a Changing World / edited by Konstantinos Mattas, Henk Kievit, Gert van Dijk, George Baourakis, Constantin Zopounidis

Online Resource




eco

The ecology of invasions by animals and plants / by Charles S. Elton ; with contributions by Daniel Simberloff and Anthony Ricciardi

Online Resource




eco

Latin American dendroecology: combining tree-ring sciences and ecology in a megadiverse territory / Marín Pompa-García, J. Julio Camarero, editors

Online Resource




eco

Fire in California's ecosystems / edited by Jan W. van Wagtendonk, Neil G. Sugihara, Scott L. Stephens, Andrea E. Thode, Kevin E. Shaffer, and JoAnn Fites-Kaufman

Dewey Library - QH105.C2 F57 2018




eco

Mixed plantations of eucalyptus and leguminous trees: soil, microbiology and ecosystem services / Elke Jurandy Bran Nogueira Cardoso, José Leonardo de Moraes Gonçalves, Fabiano de Carvalho Balieiro, Avílio Antônio Franco, editors

Online Resource




eco

Museum Transformations: Decolonization and Democratization


 

MUSEUM TRANSFORMATIONS DECOLONIZATION AND DEMOCRATIZATION

Edited By ANNIE E. COOMBES ANDRUTH B. PHILLIPS

Museum Transformations: Decolonization and Democratization addresses contemporary approaches to decolonization, greater democratization, and revisionist narratives in museum exhibition and program development around the world. The text explores how museums of art, history, and ethnography responded to deconstructive critiques from activists and poststructuralist



Read More...




eco

Second train with migrant workers leaves for Ranchi

The second Shramik special train with 1,131 passengers left Kadpadi junction for Ranchi on Friday at 7.40 p.m. The passengers were brought to the stat




eco

[ASAP] Development of Lipid-Coated Semiconductor Nanosensors for Recording of Membrane Potential in Neurons

ACS Photonics
DOI: 10.1021/acsphotonics.9b01558




eco

[ASAP] Chip-Scale Reconfigurable Optical Full-Field Manipulation: Enabling a Compact Grooming Photonic Signal Processor

ACS Photonics
DOI: 10.1021/acsphotonics.0c00103




eco

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




eco

International empirical studies on religion and socioeconomic human rights Hans-Georg Ziebertz, editor

Online Resource




eco

Nationalism and the economy: explorations into a neglected relationship / edited by Stefan Berger and Thomas Fetzer

Dewey Library - JC311.N221234 2019




eco

Dying for rights: putting North Korea's human rights abuses on the record / Sandra Fahy

Dewey Library - JC599.K7 F34 2019




eco

Loaded: a disarming history of the Second Amendment / Roxanne Dunbar Ortiz

Dewey Library - HV7436.D86 2018




eco

Inequality and democratic egalitarianism: 'Marx's economy and beyond' and other essays / Mark Harvey and Norman Geras

Dewey Library - JC575.H378 2018




eco

NGOs have become a 'racket' and 'mafia': Jairam Ramesh

Politicians and NGOs have developed a close association, said Ramesh.




eco

26/11 Terror Attack: Magistrate denies recording false confession of Ajmal Kasab

"Not true that I recorded false statement of Kasab when he was produced before me"




eco

Delhi ATM cash heist: Absconding cash van driver arrested, looted money recovered

Thirty-year old Satish and his cousin Shailender have been arrested from Etah in U.P.




eco

Nine live bombs recovered in Ranchi

Police also seized 19 gelatin sticks and two clocks fitted to the bombs.




eco

NIA handed second case of Patna serial blasts

Two cases were registered in Bihar in connection with the October 27 serial blasts.




eco

Pune ad professionals died in accident, bodies of 3 recovered from Nira river

While Chintan's body was recovered from the river water, the other three remained in the car.




eco

Srinagar records first sub-zero temperature of season

Pahalgam was the coldest place in Kashmir valley with minimum temperature of minus 4 degree Celsius.




eco

Chhattisgarh polls: 15% turnout in initial hours of second phase voting

No untoward incident has been reported so far from any part of the state.




eco

CWG scam: PMO refuses info on Shunglu recommendations on CAG

Commonwealth Games were held from December 3-14, 2010 in the national capital.




eco

Tehelka journalist 'recorded' calls from Tarun Tejpal, Shoma Chaudhury

Tarun Tejpal has been accused of raping his junior colleague during an event in Goa.




eco

All for a cause: Woman takes on politics of road blockade in Kerala, becomes a rage

Her outburst has triggered a wave against the practice of preventing common man's freedom.




eco

Domain decomposition methods in science and engineering XVI [electronic resource] / Olof B. Widlund, David E. Keyes, (eds.)

Berlin ; New York : Springer, [2007]




eco

Tales of an ecotourist : what travel to wild places can teach us about climate change / Mike Gunter Jr

Gunter, Michael M., 1969- author




eco

The social metabolism : a socio-ecological theory of historical change / Manuel González de Molina, Víctor M. Toledo

González de Molina Navarro, Manuel, author




eco

Applying graph theory in ecological research / Mark R.T. Dale (University of Northern British Columbia)

Dale, Mark R. T. (Mark Randall Thomas), 1951- author




eco

Adaptive food webs : stability and transitions of real and model ecosystems / edited by John C. Moore (Colorado State University, CO, USA), Peter C. de Ruiter (Wageningen Universiteit, The Netherlands), Kevin S. McCann (University of Guelph, ON, Canada),




eco

Economics and liability for environmental problems / edited by Kathleen Segerson (University of Connecticut, USA)




eco

Ecology / William D. Bowman (University of Colorado), Sally D. Hacker (Oregon State University), Michael L. Cain (New Mexico State University)

Bowman, William D., author




eco

Monitoring threatened species and ecological communities / editors: Sarah Legge, David B Lindenmayer, Natasha M Robinson, Benjamin C Scheele, Darren M. Southwell and Brendan C. Wintle




eco

Why big fierce animals are rare : an ecologist's perspective / Paul Colinvaux ; with a new foreword by Cristina Eisenberg

Colinvaux, Paul, 1930- author




eco

Recovering Australian threatened species : a book of hope / editors: Stephen Garnett, Peter Latch, David Lindenmayer and John Woinarski




eco

Complex ecology : foundational perspectives on dynamic approaches to ecology and conservation / edited by Charles G. Curtin (University of Montana), Timothy F.H. Allen (University of Wisconsin, Madison)




eco

Silvopasture : a guide to managing grazing animals, forage crops, and trees in a temperate farm ecosystem / Steve Gabriel ; foreword by Eric Toensmeier

Gabriel, Steve, 1982- author




eco

Sustainable intensification of agriculture : greening the world's food economy / Jules Pretty and Zareen Pervez Bharucha

Pretty, Jules N., author




eco

Satellite remote sensing for conservation action : case studies from aquatic and terrestrial ecosystems / edited by Allison K. Leidner (ASRC Federal/National Aeronautics and Space Administration), Graeme M. Buchanan (RSPB, Edinburgh, UK)




eco

Navios de terra videorecording] / escrito, dirigido e produzido por Simone Cortezão ; produção Ana Moravi, Bea França, Simone Cortezão