1

This works for video (With the code snippet camera changes to backface camera)

 videoPlayer.record().stopDevice();
 videoPlayer.record().setVideoInput('backface-camera-device-id');

But analogically for image doesn't change anything. Camera still the same (Only frontface camera)

 imagePlayer.record().stopDevice();
 imagePlayer.record().setVideoInput('backface-camera-device-id');

My options for imagePlayer is

const options = {
                controls: true,
                width: width,
                height: height,
                controlBar: {
                    volumePanel: true
                },
                plugins: {
                    record: {
                        image: true,
                        imageOutputType: 'blob',
                        mandatory: {
                            minWidth: 1280,
                            minHeight: 720,
                        },
                        frameWidth: 1280,
                        frameHeight: 720,
                    }
                }
            };
const imagePlayer = videojs('image-frame', options);

Image frame is

<video id="image-frame"></video>

My video options (works only with video)

const options = {
                controls: true,
                width: width,
                height: height,
                fluid: false,
                controlBar: {
                    volumePanel: false,
                    cameraButton: true,
                },
                plugins: {
                    record: {
                        audio: true,
                        video: true,
                        videoEngine: 'recordrtc',
                        maxLength: 120,
                        debug: true,
                        mandatory: {
                            minWidth: 1280,
                            minHeight: 720,
                        },
                        frameWidth: 1280,
                        frameHeight: 720,
                        timeSlice: 1000
                    }
                }
            };

Glad to any help or clue to solve the camera switching problem!

123
  • 2,169
  • 3
  • 11
  • 35
  • 1
    What approaches did you try so far? Have you tried passing `video: { deviceId: {exact: deviceId} }` to the initializer instead of setting it afterwards? – Marcus Ilgner Feb 01 '20 at 18:48
  • @milgner, I have tried both, `video: { deviceId: {exact: deviceId} }` and `image: { deviceId: {exact: deviceId} }` - still working only for video, but with image - doesn't work. – 123 Feb 01 '20 at 18:49
  • @Andrii any updates on this issue. i'm having same problem – Ishara Madawa Oct 20 '20 at 06:50

1 Answers1

1
imagePlayer.record().recordImage = {deviceId: {exact: 'backface-camera-device-id'}};
imagePlayer.record().stopDevice();
imagePlayer.record().getDevice();

worked for me.

David Buck
  • 3,752
  • 35
  • 31
  • 35
Fabian84
  • 11
  • 1