Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecordRTC is not working in android app #293

Open
Nitrick opened this issue Jun 30, 2017 · 3 comments
Open

RecordRTC is not working in android app #293

Nitrick opened this issue Jun 30, 2017 · 3 comments

Comments

@Nitrick
Copy link

Nitrick commented Jun 30, 2017

Hi,

I have made one application which will record the audio only, and when i am deploying in the android phone it is not working and i am asking for the permission and the recording starts but when i try to check whether it is recorded or not the audio is not coming from the recorded file is their any thing i can work on to solve this issue help on this problem Muaz Khan
`function StartRecording() {
var button = document.querySelector('#btn-start-recording');

    if (button.innerHTML === 'Stop Recording') {
        $ionicLoading.show();
        button.disabled = true;
        button.disableStateWaiting = true;
        setTimeout(function () {
            button.disabled = false;
            button.disableStateWaiting = false;
        }, 2000);

        button.innerHTML = 'Star Recording';

        function stopStream() {
            if (button.stream && button.stream.stop) {
                button.stream.stop();
                button.stream = null;
            }

            if (button.stream instanceof Array) {
                button.stream.forEach(function (stream) {
                    stream.stop();
                });
                button.stream = null;
            }


        }

        if (button.recordRTC) {
            debugger
            if (button.recordRTC.length) {

                button.recordRTC[0].stopRecording(function (url) {
                    if (!button.recordRTC[1]) {
                        button.recordingEndedCallback(url);
                        stopStream();
                        saveToDiskOrOpenNewTab(button.recordRTC);
                        return;
                    }

                    button.recordRTC[1].stopRecording(function (url) {
                        button.recordingEndedCallback(url);
                        stopStream();
                    });
                });
            }
            else {
                button.recordRTC.stopRecording(function (url) {
                    button.recordingEndedCallback(url);
                    stopStream();
                    saveToDiskOrOpenNewTab(button.recordRTC);
                });
            }
        }

        return;
    }

    button.disabled = true;

    var commonConfig = {
        onMediaCaptured: function (stream) {
            button.stream = stream;
            if (button.mediaCapturedCallback) {
                button.mediaCapturedCallback();
            }

            button.innerHTML = 'Stop Recording';
            button.disabled = false;
        },
        onMediaStopped: function () {
            button.innerHTML = 'Start Recording';
            if (!button.disableStateWaiting) {
                button.disabled = false;
            }
        },
        onMediaCapturingFailed: function (error) {

        }
    };

    mimeType = 'audio/wav';
    fileExtension = 'wav'; // ogg or webm?
    recorderType = null;
    type = 'audio';
    captureAudio(commonConfig);
    button.mediaCapturedCallback = function () {
        var options = {
            type: type,
            mimeType: mimeType,
            leftChannel: params.leftChannel || false,
            disableLogs: params.disableLogs || false
        };

        if (params.sampleRate) {
            options.sampleRate = parseInt(params.sampleRate);
        }

        if (params.bufferSize) {
            options.bufferSize = parseInt(params.bufferSize);
        }


        if (webrtcDetectedBrowser === 'edge') {
            options.numberOfAudioChannels = 1;
        }

        button.recordRTC = RecordRTC(button.stream, options);

        button.recordingEndedCallback = function (url) {
            setVideoURL(url);
        };

        button.recordRTC.startRecording();

    };
};`
@muaz-khan
Copy link
Owner

Are you using cordova or testing directly using Chrome browser?

If you're using cordova, please share chromium version (i.e. android + crosswalk-project versions).

@Nitrick
Copy link
Author

Nitrick commented Jul 3, 2017

android version 5.1+
cordova version 6.0.0+
and i am not using crosswalk

@Nitrick
Copy link
Author

Nitrick commented Jul 13, 2017

hello Muaz Khan

Is their any solution on this issue because in some mobile recording is working properly but in some its not even recording the audio i am asking microphone permission but is not recording in Samsung and mi mobile can you help me out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants