Beispiel #1
0
            public async void WebSocket(int roomId)
            {
                LiveChatListener listener = new LiveChatListener();
                await listener.ConnectAsync(roomId);

                listener.MessageReceived += Listener_MessageReceived;
                //Debug.LogError(MessageBox(IntPtr.Zero, "???", "只有红茶了可以吗", 1));
                //jiba();
            }
Beispiel #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            string A = System.IO.Path.Combine(new FileInfo(Assembly.GetEntryAssembly().Location).DirectoryName, "libvlc", /*IntPtr.Size == 4 ?*/ "win-x64" /*: "win-x64"*/);

            this.VlcControl.SourceProvider.CreatePlayer(new DirectoryInfo(A));

            this.Dispatcher.Invoke(new Action(delegate
            {
                提示框.Visibility = Visibility.Visible;
                提示文字.Content   = "该房间已开播,检测直播流状态,等待推流数据中....";
            }));
            new Task((() =>
            {
                try
                {
                    listener.ConnectAsync(int.Parse(DD.DownIofo.房间_频道号));
                    listener.MessageReceived += Listener_MessageReceived;
                }
                catch (Exception)
                {
                }
                MMPU.DownList.Add(DD);
                if (DD.DownIofo.是否是播放任务)
                {
                    DD.Start("缓冲视频中");
                    DD.DownIofo.备注 = "缓冲视频中";
                }
                else
                {
                    DD.Start("直播观看缓冲进行中");
                    DD.DownIofo.备注 = "直播观看缓冲进行中";
                }

                Thread.Sleep(MMPU.播放缓冲时长 * 1000);
                this.Dispatcher.Invoke(new Action(delegate
                {
                    提示框.Visibility = Visibility.Collapsed;
                }));
                try
                {
                    this.Dispatcher.Invoke(new Action(delegate
                    {
                        try
                        {
                            Play_SETVolume((int)音量.Value);
                            //this.VlcControl.SourceProvider.MediaPlayer.Audio.Volume = (int)音量.Value;
                        }
                        catch (Exception)
                        {
                        }
                    }));

                    // Aplayer.Open(DD.DownIofo.文件保存路径);
                    // this.VlcControl.SourceProvider.MediaPlayer.Play(new Uri(DD.DownIofo.文件保存路径));
                    this.VlcControl.SourceProvider.MediaPlayer.EndReached += 播放到达结尾触发事件;;
                    Play_Open(DD.DownIofo.文件保存路径);
                    //Aplayer.OnStateChanged += 播放到达结尾触发事件;
                    播放状态 = true;
                    if (DD.DownIofo.平台 == "bilibili")
                    {
                        //获取弹幕();
                    }
                }
                catch (Exception)
                {
                    ;
                }
            })).Start();
        }