コード例 #1
0
 private void AddLivestreamBroadcastDialog_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(addLivestreamBroadcastDialog.Title) && !string.IsNullOrWhiteSpace(addLivestreamBroadcastDialog.Description))
     {
         var broadcast  = YoutubeApiHelper.CreateLiveBroadcast(addLivestreamBroadcastDialog.Title, addLivestreamBroadcastDialog.Description, addLivestreamBroadcastDialog.MadeForKids);
         var livestream = YoutubeApiHelper.CreateLiveStream(addLivestreamBroadcastDialog.Title, addLivestreamBroadcastDialog.Description, addLivestreamBroadcastDialog.Format, addLivestreamBroadcastDialog.Fps);
         YoutubeApiHelper.ConnectStreamToBroadcast(livestream.Id, broadcast.Id);
         var newLivebroadcast = new LivestreamBroadcast()
         {
             LiveBroadcastDescription = addLivestreamBroadcastDialog.Description,
             LiveBroadcastTitle       = addLivestreamBroadcastDialog.Title,
             LiveStreamBroadcastId    = broadcast.Id,
             Playlist         = addLivestreamBroadcastDialog.Playlist,
             PlaylistName     = addLivestreamBroadcastDialog.Playlist.PlaylistName,
             LiveStreamId     = livestream.Id,
             LivestreamName   = livestream.Cdn.IngestionInfo.StreamName,
             LivestreamStatus = broadcast.Status.LifeCycleStatus,
             MadeForKids      = (bool)broadcast.Status.MadeForKids,
             Format           = addLivestreamBroadcastDialog.Format,
             Fps = addLivestreamBroadcastDialog.Fps
         };
         livestreamBroadcasts.Add(newLivebroadcast);
         updateLivesBroadcastSource();
     }
 }