Skip to content
This repository was archived by the owner on Mar 1, 2024. It is now read-only.
This repository was archived by the owner on Mar 1, 2024. It is now read-only.

[BUG] - WebRTCMaxBitrate ,WebRTCMinBitrate setting is not working #470

@ysh0514

Description

@ysh0514

UE Version:
UE 5.3

Frontend Version:
UE5.3-0.3.0
NextJs - 14

Problem component
Frontend

Description

'use client';

import React from 'react';
import { TestPixelStreamingWrapper } from '@/components/TestPixelStreamingWrapper';

export default function page() {
  return (
    <div
      style={{
        height: '100%',
        width: '100%',
      }}
    >
      <TestPixelStreamingWrapper
        initialSettings={{
          AutoPlayVideo: true,
          AutoConnect: true,
          StartVideoMuted: true,
          ss: 'streaming server url',
          HoveringMouse: true,
          ControlsQuality: true,
          WebRTCMaxBitrate: 1000,
          WebRTCMinBitrate: 0,
        }}
      />
    </div>
  );
}

// Copyright Epic Games, Inc. All Rights Reserved.
'use client';

import React, { useEffect, useRef, useState } from 'react';
import { Config, AllSettings, PixelStreaming } from '@epicgames-ps/lib-pixelstreamingfrontend-ue5.3';

export interface PixelStreamingWrapperProps {
  initialSettings?: Partial<AllSettings>;
}

export const TestPixelStreamingWrapper = ({ initialSettings }: PixelStreamingWrapperProps) => {
  // A reference to parent div element that the Pixel Streaming library attaches into:
  const videoParent = useRef<HTMLDivElement>(null);

  // Pixel streaming library instance is stored into this state variable after initialization:
  const [pixelStreaming, setPixelStreaming] = useState<PixelStreaming>();

  // A boolean state variable that determines if the Click to play overlay is shown:
  const [clickToPlayVisible, setClickToPlayVisible] = useState(false);

  // Run on component mount:
  useEffect(() => {
    if (videoParent.current) {
      // Attach Pixel Streaming library to videoParent element:
      const config = new Config({ initialSettings });
      const streaming = new PixelStreaming(config, {
        videoElementParent: videoParent.current,
      });

      // register a playStreamRejected handler to show Click to play overlay if needed:
      streaming.addEventListener('playStreamRejected', () => {
        setClickToPlayVisible(true);
      });

      // Save the library instance into component state so that it can be accessed later:
      setPixelStreaming(streaming);

      // Clean up on component unmount:
      return () => {
        try {
          streaming.disconnect();
        } catch {}
      };
    }
  }, []);

  return (
    <div
      style={{
        width: '100%',
        height: '100%',
        position: 'relative',
      }}
    >
      <div
        style={{
          width: '100%',
          height: '100%',
        }}
        ref={videoParent}
      />
      {clickToPlayVisible && (
        <div
          style={{
            position: 'absolute',
            top: 0,
            left: 0,
            width: '100%',
            height: '100%',
            display: 'flex',
            alignItems: 'center',
            justifyContent: 'center',
            cursor: 'pointer',
          }}
          onClick={() => {
            pixelStreaming?.play();
            setClickToPlayVisible(false);
          }}
        >
          <div>Click to play</div>
        </div>
      )}
    </div>
  );
};


WebRTCMaxBitrate ,WebRTCMinBitrate setting is not working

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requeststale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions