transcord

0.2.0 • Public • Published

Transcord

A simple recording and transcription module.

Summary

Getting started

Quick Start

Multiples start options are available :

Installation

Include the file :

<script src="path/to/transcord.js"></script>

Usage

<!-- Create a textarea element -->
<textarea id="transcord"></textarea>
('#transcord').transcord({options});

Options

record

  • Type : Boolean
  • Default : true

Define wether to record the user audio input.

transcript

  • Type : Boolean
  • Default : true

Define wether to transcript the user audio input into text.

transcriptLanguage

  • Type : Enum
  • Default : 'en-US'

Which language the user is using.

transcriptLanguage

  • Type : Enum
  • Default : 'en-US'

Which language the user is using.

isTranscriptPersistent

  • Type : Boolean
  • Default : true

Define if the old text must be kept when updating transcription.

transcriptgrammar

  • Type : SpeechGrammarList
  • Default : undefined

Restrict instance grammar with the given SpeechGrammarList.

recordNumber

  • Type : Integer
  • Default : 1

Number of blob than can be displayed at the same time.

showMicIconNode

  • Type : Boolean || jQuery Node
  • Default : true

If the value is set to false, the mic icons aren't displayed. If the value is set to true, the mic icons are appended into the parent of target element. A jQuery node can be passed, thus appending the mics into this node.

imgMicIdle

  • Type : url
  • Default : base64 img (assets/mic.gif in b64)

Mic icon when not recording.

imgMicRecording

  • Type : url
  • Default : base64 img (assets/mic-animate.gif in b64)

Mic icon when recording.

onInit

  • Type : function
  • Default : null

Things to do on initialization.

onStart

  • Type : function
  • Default : null

Things to do when record/transcript starts.

onStop

  • Type : function
  • Default : null

Things to do when record/transcript stops.

onBlob

  • Type : function
  • Default : null

Things to do with the Blob object containing the recording. Example :

onBlob : function(event, blob){
  $(this).transcord('downloadBlob', blob, 'record');
}

Methods

The following methods can be called like this :

$().transcord('method');

startRecording

Start to record/transcript.

stopRecording

Stop to record/transcript.

toogleRecord

Start/Stop to record/transcript.

displayBlob

$('elm').transcord('displayBlob', blob, [$node]);

Display the blob in a audio tag added to $node. If node is not specified, the audio tag will be added after elm.

destroyBlob

$().transcord('displayBlob',index);

Remove the audio tag in the DOM and destroy the blob url corresponding the the index parameter. The index can be a number, an array of number and also a string. "first" will destroy the first blob recorded. "last" will destroy the last blob recorded. "all" will destroy all blobsURL.

downloadBlob

$('elm').transcord('downloadBlob', blob, [filename]);

Download the blob on client navigator. A filename can be specified.

getBlobs

Returns all the blobs of records.

trigger

Trigger event manually

Browser support

To record the user audio input, the browser must support getUserMedia()

To transcript, the browser must support the Speech Recognition API

License

MIT

⬆ back to top

Package Sidebar

Install

npm i transcord

Weekly Downloads

1

Version

0.2.0

License

MIT

Last publish

Collaborators

  • sotrx