Microphone JS Methods
You can control your <microphone> using our Javascript API. Below is a full list of the available methods.How do I call methods on a microphone instance?
Basic Methods
record
pauseRecording
resumeRecording
stopRecording
play
stopPlayback
stopRecording
publish
getState
getAudio
setMetadata
reset
destroy
Advanced Methods
connect
record_without_countdown
showRecorder
showPlayer
setMaxLength
setMinLength
setSignature
setSignatureExpiration
startUpload
restartUpload
How do I call methods on a microphone instance?
You can get your microphone's JS instance by accessing it in the CameraTag microphones array once the microphone has initialized:CameraTag.observe(YOUR_MICROPHONE_ID, "initialized", function(){ myMicrophone = CameraTag.microphones["YOUR_MICROPHONE_ID"]; })
Once you have the instance calling methods is as simple as
myMicrophone.record();
record()
Starts the recording process (preroll + recording). You should make sure that the microphone is in the readyToRecord state before calling record.pauseRecording()
Pauses recording.resumeRecording()
Started recording after a pause (will not work after recording is stopped)play()
Starts playback of recorded videostopPlayback()
Stops playbackstopRecording()
Starts the recording process (preroll + recording)publish()
published the currently recorded video. You should make sure the microphone is in the readyToPublish state before calling publish.getState()
gets the current state of the recorder- returns one of:- initialized
- recording
- readyToPublish
- publishing
- published
- processed
getVideo()
Returns a JS Object containing information about the video to be recorded. This object will contain the video UUID, recording formats, and (once the microphone is in the published state) video and thumbnail URLs{ "id": "00017b40-164d-0130-b327-12313b093125", "camera_id": "51d36a00-7a03-0130-3e48-1231390fcc11", "user_id": "543cbeb0-7944-0130-3e26-1231390fcc11", "uuid": "00017b40-164d-0130-b327-12313b093125", "file": null, "size": null, "params": null, "state": "processed", "origin": "Framey Import", "created_at": "2012-11-21T21:04:45.000Z", "updated_at": "2013-03-29T16:55:11.000Z", "form_data": null, "short_code": null, "browser": null, "ip": null, "publish_type": null, "published_at": null, "media_type": null, "notified_at": null, "queue_name": null, "queue_id": null, "client_version": null, "host": "assets.cameratag.com", "media_accesses_count": 0, "name": null, "description": null, "moderation_state": null, "video_file_file_name": null, "video_file_content_type": null, "video_file_file_size": null, "video_file_updated_at": null, "asset_file_file_name": null, "asset_file_content_type": null, "asset_file_file_size": null, "asset_file_updated_at": null, "transcription_job_id": null, "original_filename": null, "room_id": null, "room_name": null, "user_name": null, "original_url": "https://assets.cameratag.com/recordings/00017b40-164d-0130-b327-12313b093125.flv" }