react-icons/fa APIs
- FaTwitter
- FaGithub
- FaInstagram
- FaLinkedin
- FaTimes
- FaPlus
- FaFacebookF
- FaSearch
- FaYoutube
- FaFacebook
- FaTrash
- FaHeart
- FaLinkedinIn
- FaBars
- FaEnvelope
- FaStar
- FaPlay
- FaHome
- FaEdit
- FaSun
- FaMoon
- FaUser
- FaGithubAlt
- FaFacebookSquare
- FaArrowRight
- FaCheck
- FaTwitterSquare
- FaAngleRight
- FaInfoCircle
- FaMapMarkerAlt
- FaArrowLeft
- FaPen
- FaTrashAlt
- FaShoppingCart
- FaGithubSquare
- FaCheckCircle
- FaDownload
- FaCaretDown
- FaChevronRight
- FaCog
- FaCode
- FaDev
- FaDribbble
- FaLocationArrow
- FaExternalLinkAlt
- FaAngleDown
- FaArrowUp
- FaSignOutAlt
- FaTags
- FaQuoteLeft
- FaPause
- FaChevronLeft
- FaChevronDown
- FaReact
- FaFolderOpen
- FaCircle
- FaAngleLeft
- FaCompass
- FaAlignRight
- FaMinus
- FaBoxOpen
- FaLink
- FaUsers
- FaGoogle
- FaTwitch
- FaRss
- FaSpotify
- FaCrown
- FaLock
- FaCopyright
- FaRegTrashAlt
- FaUserAlt
- FaRegStar
- FaPhone
- FaMapMarkedAlt
- FaRegCircle
- FaVolumeUp
- FaDiscord
- FaUserCircle
- FaList
- FaStackOverflow
- FaFreeCodeCamp
- FaMicrophone
- FaRedo
- FaClipboard
- FaChevronUp
- FaLongArrowAltRight
- FaAngleDoubleRight
- FaKey
- FaCubes
- FaBan
- FaMediumM
- FaPinterest
- FaVideo
- FaDribbbleSquare
- FaComment
- FaBellSlash
- FaRegBuilding
- FaSlack
- FaItunesNote
- FaBox
- FaWonSign
- FaAirbnb
- FaDoorOpen
- FaGlobe
- FaBath
- FaParking
- FaWhatsapp
- FaUserInjured
- FaRegPlusSquare
- FaPlayCircle
- FaPauseCircle
- FaVolumeMute
- FaSpinner
- FaRegLightbulb
- FaCcVisa
- FaCcMastercard
- FaCcPaypal
- FaCcAmazonPay
- FaRegHeart
- FaCartArrowDown
- FaCartPlus
- FaPinterestSquare
- FaPaypal
- FaAmazon
- FaShopify
- FaApple
- FaTruck
- FaUndoAlt
- FaRocketchat
- FaWallet
- FaPinterestP
- FaGooglePlay
- FaCaretUp
- FaFilter
- FaCalendarAlt
- FaCodeBranch
- FaExclamationCircle
- FaEye
- FaOsi
- FaRegEdit
- FaMicrophoneAlt
- FaMicrophoneAltSlash
- FaCogs
- FaEllipsisH
- FaEquals
- FaQrcode
- FaAddressBook
- FaServer
- FaFolder
- FaLongArrowAltLeft
- FaSkype
- FaHandHoldingHeart
- FaRegPaperPlane
- FaRegBookmark
- FaInbox
- FaHamburger
- FaSearchLocation
- FaBirthdayCake
- FaUserGraduate
- FaGoogleDrive
- FaPaperPlane
- FaLockOpen
- FaUserFriends
- FaExchangeAlt
- FaEllipsisV
- FaSortAmountDown
- FaSortAmountUp
- FaCaretSquareRight
- FaCaretSquareLeft
- FaColumns
- FaUndo
- FaQuestionCircle
- FaBloggerB
- FaRedditAlien
- FaCodepen
- FaGitlab
- FaBlogger
- FaCameraRetro
- FaTabletAlt
- FaRegNewspaper
- FaRegCalendarAlt
- FaForward
- FaQuoteRight
- FaVoteYea
- FaShareSquare
- FaBehanceSquare
- FaSignInAlt
- FaSkull
- FaReddit
- FaRegSmileBeam
- FaWindowClose
- FaWindowMinimize
- FaWindowMaximize
- FaPaste
- FaStopwatch
- FaStop
- FaSave
- FaFileExport
- FaHandPointer
- FaFile
- FaMapSigns
- FaClipboardCheck
- FaClock
- FaThList
- FaDumbbell
- FaGuitar
- FaNetworkWired
- FaPuzzlePiece
- FaUserEdit
- FaEyeSlash
- FaPhoneAlt
- FaStickyNote
- FaThumbsUp
- FaThumbsDown
- FaArrowCircleUp
- FaLightbulb
- FaBookOpen
- FaRegSquare
- FaItalic
- FaBold
- FaPencilAlt
- FaSlash
- FaShapes
- FaShip
- FaTree
- FaFilePdf
- FaRegArrowAltCircleRight
- FaFileUpload
- FaKeyboard
- FaBehance
- FaGoodreadsG
- FaProductHunt
- FaXing
- FaBolt
OtherRelated APIs
react-icons/fa#FaMicrophoneAlt JavaScript Examples
The following examples show how to use
react-icons/fa#FaMicrophoneAlt.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Record.js From aws-amplify-quick-notes with MIT No Attribution | 4 votes |
RecordComponent = props => {
const [isRecording, setIsRecording] = useState(false);
const [showRecordingEditor, setShowRecordingEditor] = useState(false);
const [recordingText, setRecordingText] = useState("");
const [isConverting, setIsConverting] = useState("");
const [micStream, setMicStream] = useState();
const [audioBuffer] = useState(
(function() {
let buffer = [];
function add(raw) {
buffer = buffer.concat(...raw);
return buffer;
}
function newBuffer() {
console.log("reseting buffer");
buffer = [];
}
return {
reset: function() {
newBuffer();
},
addData: function(raw) {
return add(raw);
},
getData: function() {
return buffer;
}
};
})()
);
const startRecording = async () => {
const stream = await window.navigator.mediaDevices.getUserMedia({
video: false,
audio: true
});
const startMic = new mic();
startMic.setStream(stream);
startMic.on("data", chunk => {
var raw = mic.toRaw(chunk);
if (raw == null) {
return;
}
audioBuffer.addData(raw);
});
setMicStream(startMic);
setIsRecording(true);
};
const stopRecording = async () => {
micStream.stop();
setIsRecording(false);
setIsConverting(true);
const buffer = audioBuffer.getData();
const result = await Predictions.convert({
transcription: {
source: {
bytes: buffer
}
}
});
setMicStream(null);
audioBuffer.reset();
setRecordingText(result.transcription.fullText);
setIsConverting(false);
setShowRecordingEditor(true);
};
return (
<Container>
<div
css={css`
position: relative;
justify-content: center;
align-items: center;
width: 120px;
height: 120px;
`}
>
<div
css={[
css`
width: 100%;
height: 100%;
top: 0;
left: 0;
position: absolute;
border-radius: 50%;
background-color: #74b49b;
`,
isRecording || isConverting
? css`
animation: ${pulse} 1.5s ease infinite;
`
: {}
]}
/>
<div
css={css`
width: 100%;
height: 100%;
top: 0;
left: 0;
position: absolute;
border-radius: 50%;
background-color: #74b49b;
display: flex;
cursor: pointer;
`}
onClick={() => {
if (!isRecording) {
startRecording();
} else {
stopRecording();
}
}}
>
{isConverting ? (
<FaMicrophoneAltSlash
size={50}
style={{ margin: "auto" }}
/>
) : isRecording ? (
<FaMicrophone
size={50}
style={{ margin: "auto" }}
/>
) : (
<FaMicrophoneAlt
size={50}
style={{ margin: "auto" }}
/>
)}
</div>
</div>
{showRecordingEditor && (
<RecordingEditor
text={recordingText}
onDismiss={() => {
setShowRecordingEditor(false);
}}
onSave={async data => {
await API.graphql(graphqlOperation(createNote, { input: data }));
props.setTabIndex(0);
}}
/>
)}
</Container>
);
}