Skip to content

rhedgpeth/Xamarin-Yasea

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xamarin-Yasea

RTMP live streaming client for Xamarin.Android

Yet Another Stream Encoder for Android

Xamarin-Yasea is an Xamarin Android streaming client. It encodes YUV and PCM data from camera and microphone to H.264/AAC, encapsulates in FLV and transmits over RTMP.

Feature

  • Android mini API 16.
  • H.264/AAC hard encoding.
  • H.264 soft encoding.
  • RTMP streaming with state callback handler.
  • Portrait and landscape dynamic orientation.
  • Front and back cameras hot switch.
  • Recording to MP4 while streaming.
  • Beautiful filters with GPUImage.
  • Acoustic echo cancellation and automatic gain control support.

C#

using Com.Github.Faucamp.Simplertmp;
using Com.Seu.Magicfilter.Utils;
using Net.Ossrs.Yasea;

const string rtmpUrl = "rtmp://xxx.xxx.x.xxx:1935/live/<SteamID>";

Button btnPublish;
SrsPublisher mPublisher;

protected override void OnCreate(Bundle savedInstanceState)
{
    base.OnCreate(savedInstanceState);
    
    mPublisher = new SrsPublisher((SrsCameraView)FindViewById(Resource.Id.glsurfaceview_camera));
    mPublisher.SetEncodeHandler(new SrsEncodeHandler(this));
    mPublisher.SetRtmpHandler(new RtmpHandler(this));
    mPublisher.SetRecordHandler(new SrsRecordHandler(this));
    mPublisher.SetPreviewResolution(640, 360);
    mPublisher.SetOutputResolution(360, 640);
    mPublisher.SetVideoHDMode();
    mPublisher.StartCamera();
}

protected void OnPublishClick(object sender, EventArgs e)
{
    if (btnPublish.Text == "Publish")
    {
        mPublisher.StartPublish(rtmpUrl);
        mPublisher.StartCamera();

        btnPublish.Text = "Stop";
    }
    else if (btnPublish.Text == "Stop")
    {
        mPublisher.StopPublish();
        btnPublish.Text = "Publish";
    }
}

Credit/Props

**Xamarin-Yasea is a Xamarin.Android binding library based on Yasea; https://github.com/begeekmyfriend/yasea

About

RTMP live streaming client for Xamarin.Android

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages