Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 16060

Opening Automatic Webcam Live Broadcast on Youtube with C#

$
0
0

I want to make an automatic live broadcast on YouTube with C#, but in the code below, it does not start the live broadcast, it only does planning and does not select the radio button required to open the live broadcast, not for children. How can I solve this problem?

Other than that, it works fine, the API responds very quickly, but the live broadcast does not start. On the broadcast screen on YouTube, the text "Waiting for YouTube C# trial (channel name)" is written.

try{    // YouTube API kimlik bilgileri    string clientId = "clientId";    string clientSecret = "clientSecret";    string redirectUri = "http://localhost";    // YouTube API ayarları    var credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(        new ClientSecrets { ClientId = clientId, ClientSecret = clientSecret },        new[] { YouTubeService.Scope.Youtube },"user",        System.Threading.CancellationToken.None,        new FileDataStore("YouTube.Auth.Store"));    var youtubeService = new YouTubeService(new BaseClientService.Initializer()    {        HttpClientInitializer = credential,        ApplicationName = "YourAppName"    });    // Yeni bir canlı yayın oluşturma    var liveBroadcast = new LiveBroadcast    {        Snippet = new LiveBroadcastSnippet        {            Title = "Your broadcast title",            ScheduledStartTime = DateTime.Now        },        Status = new LiveBroadcastStatus { PrivacyStatus = "public" }    };    // Canlı yayını oluşturma isteği gönderme    var insertRequest = youtubeService.LiveBroadcasts.Insert(liveBroadcast, "snippet,status");    var insertedBroadcast = await insertRequest.ExecuteAsync();    // Oluşturulan canlı yayının ID'sini al    string broadcastId = insertedBroadcast.Id;    // Canlı yayını yayına al    liveBroadcast.Status.PrivacyStatus = "public";    liveBroadcast.Id = broadcastId;    var updateRequest = youtubeService.LiveBroadcasts.Update(liveBroadcast, "snippet,status");    await updateRequest.ExecuteAsync();    // Canlı yayın URL'sini oluştur    string liveUrl = $"https://www.youtube.com/watch?v={broadcastId}";    // Kullanıcıya canlı yayın URL'sini gönder    await message.Channel.SendMessageAsync($"Canlı yayın başlatıldı: {liveUrl}");}catch (Exception ex){    await message.Channel.SendMessageAsync(ex.Message);}

My goal is actually to create an automatic camera system. I will run this C# code on the Raspery Pi and add a live broadcast feature to YouTube by attaching a few cameras. Then, using C# Net Maui, I will write software that can automatically transfer these YouTube videos to my application on the phone.

All you have to do is show me how to stream in C# using the YouTube API and camera.


Viewing all articles
Browse latest Browse all 16060

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>