Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
887 B
1
Indexable
Never
import agora_sdk_python

# Create an instance of the AgoraRtcEngine class
engine = agora_sdk_python.AgoraRtcEngine()

# Initialize the AgoraRtcEngine object
engine.initialize("your_app_id")

# Set the channel profile to communication (1) or live broadcasting (2)
engine.setChannelProfile(1)

# Set the role of the user to broadcaster (1) or audience (2)
engine.setClientRole(1)

# Join the channel using the AgoraRtcEngine object
engine.join("your_channel_name", "optional_token", 0)

# Set the video encoding profile
engine.setVideoEncoderConfiguration(
    width=640,
    height=360,
    frameRate=15,
    bitrate=500,
    orientationMode=1
)

# Enable the local video
engine.enableVideo()

# Set the local video view
engine.setupLocalVideo(agora_sdk_python.AgoraRtcEngine.AgoraVideoCanvas(
    view=local_video_view,
    uid=0
))

# Start the local video preview
engine.startPreview()