Skip to content

[Cannot Reproduce] Setting resolution for push and pull streaming using WebRTC is not working ,Android #4262

@lichao5585

Description

@lichao5585

html code

<script type="text/javascript">
        $(function() {
            let sdk = null; 

            const startPublish = async function() {
                const videoElement = $('#rtc_media_player')[0];

                
                try {
                    const stream = await navigator.mediaDevices.getUserMedia({
                        video: {
                            width: { ideal: 3840 }, // 4K
                            height: { ideal:  2160}, // 4K
                            frameRate: { ideal: 60, max: 120 } // 
                        },
                        audio: true // 
                    });

                  
                    if (sdk) {
                        sdk.close();
                    }

                    sdk = new SrsRtcPublisherAsync();
                    videoElement.srcObject = stream;
                    sdk.stream = stream; 

                    const url = "webrtc://xxxxxx";
                    await sdk.publish(url); 
                    console.log("success!");
                    alert("success");
                } catch (error) {
                    console.error("failed :", error);
                    alert("failed : " + error.message);
                    if (sdk) sdk.close();
                }
            };

            $("#btn_publish").click(startPublish);
        });
    </script>

srs.sdk.js code

self.constraints = {
        audio: true,
        video: {
            width: {ideal: 3840},
            height: { ideal: 2160 },
            frameRate: { ideal: 60, max: 120 }
            // facingMode: 'environment'
        }
    };

But the actual recording is 720 * 1280 should i need to configure any additional information

Metadata

Metadata

Labels

AI HandledThis issue is fixed by AI, or the PR is reviewed by AI, or the discussion is replied to by AI.EnglishNativeThis issue is conveyed exclusively in English.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions