MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / onStream

Function onStream

Ports/JavaScriptPort/src/main/webapp/js/fontmetrics.js:2800–2905  ·  view source on GitHub ↗
(_stream, privileged)

Source from the content-addressed store, hash-verified

2798
2799
2800 function onStream(_stream, privileged) {
2801 if ((isIOS() || isSafari) && !privileged) {
2802 cn1RunPrivileged(function() {
2803 onStream(_stream, true);
2804 });
2805 return;
2806 }
2807 /*
2808 if (!isIOS() && isSafari && !window.cn1MicrophoneAccessGranted) {
2809 // Unbelievable!! The standard MEI tests fail in Safari on Mac.
2810 // I.e. It will pass the MEI check even if it should fail.
2811 // We fill force a fail on the MEI check the first time we request
2812 // microphone access on safari because if we don't, it won't pick up
2813 // any audio the first time around.
2814 failedMEICheck = true;
2815 }
2816 */
2817 window.cn1MicrophoneAccessGranted = true;
2818 console.log("In getUserMedia callback");
2819 pendingGetUserMedia = false;
2820
2821 stream = _stream;
2822 if (failedMEICheck) {
2823 failedMEICheck = false;
2824 console.log("Failed MEI Check, so we're going back to basics");
2825 pause();
2826 notAllowedCallback();
2827
2828 return;
2829 }
2830 if (paused) {
2831 console.log("recorder paused before we got user media");
2832 try {
2833 pause();
2834 } catch (ex) {
2835 console.log("pause() threw exception", ex);
2836 }
2837
2838 onError("Record was paused");
2839 return;
2840 }
2841 try {
2842
2843 if (origChannelCount < 0) {
2844 origChannelCount = audioCtx.destination.channelCount;
2845 }
2846 if (origSampleRate < 0) {
2847 origSampleRate = audioCtx.sampleRate;
2848 }
2849 audioInput = audioCtx.createMediaStreamSource(stream);
2850 if (!audioCtx.createJavascriptNode && !audioCtx.createScriptProcessor) {
2851 console.log("Failed to create audio context");
2852 onError("Failed to create audio context");
2853 return;
2854 }
2855
2856 console.log("recording now");
2857

Callers

nothing calls this directly

Calls 9

isIOSFunction · 0.85
pauseFunction · 0.85
onErrorFunction · 0.85
setupAudioProcessingFunction · 0.85
logMethod · 0.65
forEachMethod · 0.65
closeMethod · 0.65
disconnectMethod · 0.65
connectMethod · 0.45

Tested by

no test coverage detected