public void live_viewer_loaded(string m_uri_string)
        {
            // 여러개의 주소를 배열에 저장
            string[] uri_split = m_uri_string.Split(' ');
            num = uri_split.Length;

            for (int i = 0; i < uri_split.Length; i++)
            {
                string[] uri = uri_split[i].Split('_');
                // 초기접속 or 재접속
                if (uri[1] == "1")
                {
                    bool exist = false;
                    for (int k = 0; k < uri_list.Count; k++)
                    {
                        // 재접속 경우 : 새로고침
                        if (uri[0] == uri_list[k])
                        {
                            exist = true;
                            live_player streaming_player = new live_player();

                            streaming_player.m_uri = uri[0];
                            streaming_player.media_play();

                            myLivePlayers.Items.Remove(streaming_player_list[k]);
                            myLivePlayers.Items.Add(streaming_player);

                            break;
                        }
                    }
                    // 초기접속인 경우 : viewer에 player를 추가
                    if (exist == false)
                    {
                        live_player streaming_player = new live_player();

                        streaming_player.m_uri = uri[0];
                        streaming_player.media_play();

                        uri_list.Add(uri[0]);
                        myLivePlayers.Items.Add(streaming_player);
                        streaming_player_list.Add(streaming_player);
                    }
                }

                double_click();
                myLivePlayers_btn.ItemsSource = Buttons;
            }
        }
Пример #2
0
        public void live_viewer_loaded(string m_uri_string)
        {
            string[] uri_list = m_uri_string.Split('^');
            num = uri_list.Length;

            //0이 컴퓨터, 1이 핸드폰
            bool[,] uri_first = new bool[num, 2];
            bool[] first = new bool[num];
            string[,] rtmp_uri = new string[num, 2];

            for (int i = 0; i < num; i++)
            {
                string[] uri = uri_list[i].Split(',');

                first[i]        = true;
                uri_first[i, 0] = true;
                uri_first[i, 1] = true;

                rtmp_uri[i, 0] = uri[0];
                rtmp_uri[i, 1] = uri[1];
            }

            for (int i = 0; i < num; i++)
            {
                if (rtmp_uri[i, 0] != "null" && rtmp_uri[i, 1] != "null")
                {
                    if (first[i] == true)
                    {
                        first[i] = false;

                        live_player streaming_player = new live_player();

                        streaming_player.m_uri = rtmp_uri[i, 1];
                        streaming_player.media_play();

                        streaming_player.m_uri2 = rtmp_uri[i, 0];
                        streaming_player.media_play2();

                        myLivePlayers.Items.Add(streaming_player);
                    }
                }


                //if (rtmp_uri[i, 0] != "null" && uri_first[i, 0] == true)
                //{
                //    uri_first[i, 0] = false;
                //    // 초기 접속
                //    if (first[i] == true)
                //    {
                //        first[i] = false;

                //        live_player streaming_player = new live_player();

                //        streaming_player.m_uri2 = rtmp_uri[i, 0];
                //        streaming_player.media_play2();

                //        myLivePlayers.Items.Add(streaming_player);
                //        streaming_player_list.Add(streaming_player);
                //    }
                //    //재접속
                //    else
                //    {
                //        live_player streaming_player = new live_player();

                //        if (streaming_player_list[i].m_uri != "null")
                //        {
                //            streaming_player.m_uri = rtmp_uri[i, 1];
                //            streaming_player.media_play();
                //        }

                //        streaming_player.m_uri2 = rtmp_uri[i, 0];
                //        streaming_player.media_play2();

                //        myLivePlayers.Items.Remove(streaming_player_list[i]);
                //        streaming_player_list.Remove(streaming_player_list[i]);

                //        myLivePlayers.Items.Add(streaming_player);
                //        streaming_player_list.Add(streaming_player);
                //    }

                //}
                //else if (rtmp_uri[i, 1] != "null" && uri_first[i, 1] == true)
                //{
                //    uri_first[i, 1] = false;
                //    // 초기 접속
                //    if (first[i] == true)
                //    {
                //        first[i] = false;

                //        live_player streaming_player = new live_player();

                //        streaming_player.m_uri = rtmp_uri[i, 1];
                //        streaming_player.media_play();

                //        myLivePlayers.Items.Add(streaming_player);
                //        streaming_player_list.Add(streaming_player);
                //    }
                //    //재접속
                //    else
                //    {
                //        live_player streaming_player = new live_player();

                //        if (streaming_player_list[i].m_uri2 != "null")
                //        {
                //            streaming_player.m_uri2 = rtmp_uri[i, 0];
                //            streaming_player.media_play2();
                //        }
                //        streaming_player.m_uri = rtmp_uri[i, 1];
                //        streaming_player.media_play();


                //        myLivePlayers.Items.Remove(streaming_player_list[i]);
                //        streaming_player_list.Remove(streaming_player_list[i]);

                //        myLivePlayers.Items.Add(streaming_player);
                //        streaming_player_list.Add(streaming_player);
                //    }
                //}
                //else if (rtmp_uri[i, 0] == "null")
                //{
                //    uri_first[i, 0] = true;
                //}
                //else if (rtmp_uri[i, 1] == "null")
                //{
                //    uri_first[i, 1] = true;
                //}
            }

            //    double_click();
            //    myLivePlayers_btn.ItemsSource = Buttons;
        }