Giter Club home page Giter Club logo

agora-c_sharp-sdk's People

Contributors

alekseyisakin avatar hugochaan avatar mberky avatar peilinok avatar xiayangqun avatar yiqingjackiehuang avatar zhangtao1104 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

agora-c_sharp-sdk's Issues

Issue while clicking on join channel

When I am selecting the join channel option it is giving error that unable to find entry point for CreateIrisRtcEngine method and AgoraRtcWrapper is not loading

private AgoraRtcEngine(EngineType type = EngineType.kEngineTypeNormal)
{
_result = new CharAssistant();
_channelInstance = new Dictionary<string, AgoraRtcChannel>();
_irisRtcEngine = type == EngineType.kEngineTypeNormal
? AgoraRtcNative.CreateIrisRtcEngine()
: AgoraRtcNative.CreateIrisRtcEngine(EngineType.kEngineTypeSubProcess);

.net 5.0 or framework 4.X

If I modify the project directly to .net 5.0 or framework 4.X, will there be any pitfalls when I run it?

如果直接修改工程为 .net 5.0 或者 framework 4.X ,运行的时候会有什么坑吗?

Broadcasting custom audio to multiple channel at the same time

We are preparing a c# application which basically is supposed to live streaming Custom audio to multiple Agora Channels at the same time. Here is the code we are trying to run:

Initialize Channel

/// <summary> 

/// Intialize agora and join channel. 

/// </summary> 

[Obsolete] 

public int InitializeAgora(string token, uint uid) 

{ 

     this.agoraEngine = RtcEngine.CreateAgoraRtcEngineEx(); 

  

     // Prepare engine context 

     RtcEngineContext rtc_engine_ctx = new RtcEngineContext( 

         this.agoraAppId, 

         0, 

         CHANNEL_PROFILE_TYPE.CHANNEL_PROFILE_LIVE_BROADCASTING, 

         AUDIO_SCENARIO_TYPE.AUDIO_SCENARIO_DEFAULT); 

  

     // RtcEngineContext rtc_engine_ctx = new RtcEngineContext(); 

     rtc_engine_ctx.appId = this.agoraAppId; 

  

     // Initialize engine 

     this.agoraEngine.Initialize(rtc_engine_ctx); 

  

     // Join channel 

     this.agoraEngine.EnableAudio(); 

     this.agoraEngine.EnableLocalAudio(false); 

     this.agoraEngine.SetAudioProfile(AUDIO_PROFILE_TYPE.AUDIO_PROFILE_MUSIC_STANDARD, AUDIO_SCENARIO_TYPE.AUDIO_SCENARIO_MEETING); 

     this.agoraEngine.SetEnableSpeakerphone(false); 

     this.agoraEngine.SetExternalAudioSource(true, 16000, 1); 

  

     // this.agoraEngine.SetExternalAudioSink(true, 16000, 1); 

     this.agoraEngine.SetClientRole(CLIENT_ROLE_TYPE.CLIENT_ROLE_BROADCASTER); 

     this.agoraEngine.SetChannelProfile(CHANNEL_PROFILE_TYPE.CHANNEL_PROFILE_LIVE_BROADCASTING); 

     int joinResult = this.agoraEngine.JoinChannel(token, this.channelName, string.Empty, uid); 

     return joinResult; 

} 

Publish Buffer

/// <summary> 

/// Send the audio buffer to agora. 

/// </summary> 

/// <param name="audioData">Buffer data.</param> 

public int SendAudioFrame(byte[] audioData) 

{ 

     int pushResult = 0; 

     try 

     { 

         long currentTimeMillis = (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds; 

  

         // Assuming you have the audio frame data in bytes, send it to Agora 

         AudioFrame audioFrame = new AudioFrame(); 

         audioFrame.samplesPerSec = this.agoraSamplerate; 

         audioFrame.channels = this.agoraChannels; 

         audioFrame.RawBuffer = audioData; 

         audioFrame.renderTimeMs = currentTimeMillis; 

         audioFrame.samplesPerChannel = audioData.Length / 2; 

         audioFrame.type = AUDIO_FRAME_TYPE.FRAME_TYPE_PCM16; 

  

         // audioFrame.sam = (BYTES_PER_SAMPLE)(audioData.Length / (this.agoraChannels * 2)); 

         pushResult = this.agoraEngine.PushAudioFrame( 

             audioFrame); 

     } 

     catch (Exception ex) 

     { 

         Console.WriteLine(ex.ToString()); 

     } 

  

     return pushResult; 

} 

 

Overall class looks something like this

// <copyright file="AgoraAudioBroadcaster.cs" company="Microsoft Corporation"> 

// Copyright (c) Microsoft Corporation. All rights reserved. 

// Licensed under the MIT license. 

// </copyright> 

  

namespace TeamsBot.Agora 

{ 

    using System; 

    using global::Agora.Rtc; 

    using Newtonsoft.Json.Linq; 

  

    /// <summary> 

    /// Broadcaster for agora. 

    /// </summary> 

    public class AgoraAudioBroadcaster 

    { 

        private static readonly DateTime Jan1st1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); 

        private readonly int agoraSamplerate = 16000; 

        private readonly int agoraChannels = 1; 

        private string agoraAppId; 

        private string agoraAppCert; 

        private string channelName; 

        private IRtcEngine agoraEngine; 

  

        // private string token = "007eJxTYNBW29y2Pmjr9qu6dSJbv29K+2zz7VdfkdCt0+//dSgd/f1HgcHCONnS3NAwJcUwLcXEODHFwsLILNUsyTTFxDAxKdHUvIXnWkpDICODMAcXMyMDBIL4Egx5mSWZeQ6ZeSWpOTmZxclFmQUlxXrJ+bkMDABdpyol"; 

  

        /// <summary> 

        /// Constructor. 

        /// </summary> 

        /// <param name="agoraAppId"></param> 

        /// <param name="channelName"></param> 

        /// <param name="agoraAppCert"></param> 

        public AgoraAudioBroadcaster(string agoraAppId, string channelName, string agoraAppCert) 

        { 

            this.agoraAppId = agoraAppId; 

            this.channelName = channelName; 

            this.agoraAppCert = agoraAppCert; 

        } 

  

        /// <summary> 

        /// Intialize agora and join channel. 

        /// </summary> 

        [Obsolete] 

        public int InitializeAgora(string token, uint uid) 

        { 

            this.agoraEngine = RtcEngine.CreateAgoraRtcEngineEx(); 

  

            // Prepare engine context 

            RtcEngineContext rtc_engine_ctx = new RtcEngineContext( 

                this.agoraAppId, 

                0, 

                CHANNEL_PROFILE_TYPE.CHANNEL_PROFILE_LIVE_BROADCASTING, 

                AUDIO_SCENARIO_TYPE.AUDIO_SCENARIO_DEFAULT); 

  

            // RtcEngineContext rtc_engine_ctx = new RtcEngineContext(); 

            rtc_engine_ctx.appId = this.agoraAppId; 

  

            // Initialize engine 

            this.agoraEngine.Initialize(rtc_engine_ctx); 

  

            // Join channel 

            this.agoraEngine.EnableAudio(); 

            this.agoraEngine.EnableLocalAudio(false); 

            this.agoraEngine.SetAudioProfile(AUDIO_PROFILE_TYPE.AUDIO_PROFILE_MUSIC_STANDARD, AUDIO_SCENARIO_TYPE.AUDIO_SCENARIO_MEETING); 

            this.agoraEngine.SetEnableSpeakerphone(false); 

            this.agoraEngine.SetExternalAudioSource(true, 16000, 1); 

  

            // this.agoraEngine.SetExternalAudioSink(true, 16000, 1); 

            this.agoraEngine.SetClientRole(CLIENT_ROLE_TYPE.CLIENT_ROLE_BROADCASTER); 

            this.agoraEngine.SetChannelProfile(CHANNEL_PROFILE_TYPE.CHANNEL_PROFILE_LIVE_BROADCASTING); 

            int joinResult = this.agoraEngine.JoinChannel(token, this.channelName, string.Empty, uid); 

            return joinResult; 

        } 

  

        /// <summary> 

        /// Returns the app ID. 

        /// </summary> 

        /// <returns>returns the agora app ID.</returns> 

        public string GetAgoraAppId() 

        { 

            return this.agoraAppId; 

        } 

  

        /// <summary> 

        /// Send the audio buffer to agora. 

        /// </summary> 

        /// <param name="audioData">Buffer data.</param> 

        public int SendAudioFrame(byte[] audioData) 

        { 

            int pushResult = 0; 

            try 

            { 

                long currentTimeMillis = (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds; 

  

                // Assuming you have the audio frame data in bytes, send it to Agora 

                AudioFrame audioFrame = new AudioFrame(); 

                audioFrame.samplesPerSec = this.agoraSamplerate; 

                audioFrame.channels = this.agoraChannels; 

                audioFrame.RawBuffer = audioData; 

                audioFrame.renderTimeMs = currentTimeMillis; 

                audioFrame.samplesPerChannel = audioData.Length / 2; 

                audioFrame.type = AUDIO_FRAME_TYPE.FRAME_TYPE_PCM16; 

  

                // audioFrame.sam = (BYTES_PER_SAMPLE)(audioData.Length / (this.agoraChannels * 2)); 

                pushResult = this.agoraEngine.PushAudioFrame( 

                    audioFrame); 

            } 

            catch (Exception ex) 

            { 

                Console.WriteLine(ex.ToString()); 

            } 

  

            return pushResult; 

        } 

  

        /// <summary> 

        /// Dispose the agora engine and leave the channel. 

        /// </summary> 

        private void LeaveChannel() 

        { 

            this.agoraEngine.LeaveChannel(); 

            this.agoraEngine.Dispose(); 

            this.agoraEngine = null; 

        } 

    } 

} 

 

We create instance of the class using below code 

  private AgoraAudioBroadcaster ConfigureAgoraChannel(CallParticipantAddBody callParticipantAddBody) 

{ 

     var agoraAppId = this.configuration["AgoraAppId"]; 

     var agoraCert = this.configuration["AgoraCert"]; 

  

     AgoraAudioBroadcaster agoraAudioBroadcaster = new AgoraAudioBroadcaster(agoraAppId, callParticipantAddBody.UserPrincipalName, agoraCert); 

     var response = agoraAudioBroadcaster.InitializeAgora(callParticipantAddBody.AgoraSenderToken, (uint)callParticipantAddBody.SenderUDI); 

     return agoraAudioBroadcaster; 

} 

Problem

This code works just fine when we are trying to publish to the first channel. However, when we try to join the second channel, we get error code –17.

The app ID and certificate being used is the same, we do not have different app id for different channels.

Question

How can we publish the same audio stream to multiple agora channels at the same time?

Working on 32 bit

Hi, I'm trying to use this example using 32 bit development, but I've found that the remote video is not showing (rendering). Can anyone help? I need it to be working on 32 bit devices.

Thank you.

Warning 106

Hello,
If I run the solution and select "1v1" video for example, I am still getting "OnWarning 106" and "OnRejoinChannelSuccess" repeatedly.
I think the C# SDK does not work for me because when I join the same room in C# SDK and Web SDK, I am unable to see a strem from C# SDK on a web.

Am I missing something?
Thank you

What is iris.dll?

看到这个C# SDK通过P/Invoke调iris.dll,请问这个iris.dll是什么呢?

Join a channel without media - only chat

Hello,
I would like to join a channel without media and use the SendMessage functionality only. Use media on request lately.
I want to mimic RTM product.
In our usecase we do not need the media every time.
If there is a way how to use RTM (not RTC) with c#, please let me know.

Error dynamic use static key

Getting following error

Uncaught (in promise) AgoraRTCException: AgoraRTCError CAN_NOT_GET_GATEWAY_SERVER: flag: 4096, message: AgoraRTCError CAN_NOT_GET_GATEWAY_SERVER: dynamic use static key

I did use new key but no effect.

The Nuget only works on x86 targets

Hello, I added the Nuget to a new project, and it only runs if I set the target of my project to x86. If I set to x64, it doesn't run, giving me an exception:
An unhandled exception of type 'System.BadImageFormatException' occurred in Host_Test_1.dll
Could not load file or assembly 'agorartc, Version=3.6.2.0, Culture=neutral, PublicKeyToken=null'. Trying to load a program in incorret format.

Is there a Nuget version of the library that runs on x64 targets?

110 error when screen share

Select tap "screen share" and press "join channel" and i got 110 error
also got 1042 warning

The message shows "join ok" but i don't think it's joined.
I think other function dosen't works either.

error api
it says I need token-based authentication and i can't understand what it is.

I remember agora screen share in unity worked fine without token setting.

Any suggestion what to do?

Thank you.

Unable to load DLL 'iris.dll'

Hello!
If you do everything according to the instructions, after installing the package, building and running the project causes an exception.

System.DllNotFoundException
HResult=0x80131524
Message = Unable to load DLL 'iris.dll' or one of its dependencies: The specified module was not found. (0x8007007E)

C:\Agora-C_Sharp-SDK\OneToOneVideo\OneToOneVideo\bin\Debug\netcoreapp3.1>dotnet OneToOneVideo.dll
Unhandled exception. System.DllNotFoundException: Unable to load DLL 'iris.dll' or one of its dependencies: The specified module was not found. (0x8007007E)
at agorartc.AgorartcNative.CreateIrisEngine()
at agorartc.AgoraRtcEngine.CreateRtcEngine()
at OneToOneVideo.OneToOneVideoDemo..ctor() in C:\Agora-C_Sharp-SDK\OneToOneVideo\OneToOneVideo\OneToOneVideoDemo.cs:line 27
at OneToOneVideo.Program.Main() in C:\Agora-C_Sharp-SDK\OneToOneVideo\OneToOneVideo\Program.cs:line 20

27 string is that: "Rtc = AgoraRtcEngine.CreateRtcEngine();"

What is the problem and how can it be solved?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.