예제 #1
0
        private void OnBroadcast()
        {
            var source = StreamSource;
            var contentReaderFactory = ContentType;

            if (!CanBroadcast(source, contentReaderFactory, channelName))
            {
                return;
            }
            IYellowPageClient yellowPage = this.yellowPage;
            var channelInfo  = CreateChannelInfo(this);
            var channelTrack = CreateChannelTrack(this);

            var channel_id = BroadcastChannel.CreateChannelID(
                peerCast.BroadcastID,
                networkType,
                channelName,
                genre,
                source.ToString());
            var source_stream =
                selectedSourceStream ??
                peerCast.SourceStreamFactories
                .Where(sstream => (sstream.Type & SourceStreamType.Broadcast) != 0)
                .FirstOrDefault(sstream => sstream.Scheme == source.Scheme);
            var channel = peerCast.BroadcastChannel(
                networkType,
                yellowPage,
                channel_id,
                channelInfo,
                source,
                source_stream,
                contentReaderFactory);

            if (channel != null)
            {
                channel.ChannelTrack = channelTrack;
            }

            var info = new BroadcastInfoViewModel {
                NetworkType = this.NetworkType,
                StreamUrl   = this.StreamUrl,
                StreamType  = this.SelectedSourceStream != null ? this.SelectedSourceStream.Name : null,
                Bitrate     = this.bitrate.HasValue ? this.bitrate.Value : 0,
                ContentType = this.ContentType.Name,
                YellowPage  = this.YellowPage != null ? this.YellowPage.Name : null,
                ChannelName = this.ChannelName,
                Genre       = this.Genre,
                Description = this.Description,
                Comment     = this.Comment,
                ContactUrl  = this.ContactUrl,
                TrackTitle  = this.TrackTitle,
                TrackAlbum  = this.TrackAlbum,
                TrackArtist = this.TrackArtist,
                TrackGenre  = this.TrackGenre,
                TrackUrl    = this.TrackUrl,
                Favorite    = false,
            };

            uiSettings.AddBroadcastHistory(info);
            uiSettings.Save();
        }