/**
         * \brief  timeshift a channel and get the stream url
         * \param  OriginalURL is the URL given to us by the TVServer
         * \return value is the URL with resolved hostnames,
         */
        public static String playChannel(int chanId, bool resolveHostnames, ref string OriginalURL, ref TvControl.IUser me, ref string timeShiftFileName, ref Int64 timeShiftBufPos, ref long timeShiftBufNr)
        {
            string rtspURL      = "";
            string remoteserver = "";

            //serverIntf.StopTimeShifting(ref me);
            timeshiftChannel.Remove(me.Name);

            TvResult result = serverIntf.StartTimeShifting(chanId, ref rtspURL, ref remoteserver, ref me, ref timeShiftFileName, ref timeShiftBufPos, ref timeShiftBufNr);

            if (result != TvResult.Succeeded)
            {
                rtspURL = "[ERROR]: TVServer answer: " + result.ToString() + "|" + (int)result;
            }
            else
            {
                // we resolve any host names, as xbox can't do NETBIOS resolution..
                try
                {
                    //Workaround for MP TVserver bug when using default port for rtsp => returns rtsp://ip:0
                    rtspURL = rtspURL.Replace(":554", "");
                    rtspURL = rtspURL.Replace(":0", "");

                    OriginalURL = rtspURL;

                    if (resolveHostnames)
                    {
                        Uri       u      = new Uri(rtspURL);
                        IPAddress ipaddr = null;
                        try
                        {
                            ipaddr = IPAddress.Parse(u.DnsSafeHost); //Fails on a hostname
                        }
                        catch { }

                        if ((ipaddr == null) || (ipaddr.IsIPv6LinkLocal || ipaddr.IsIPv6Multicast || ipaddr.IsIPv6SiteLocal))
                        {
                            try
                            {
                                IPHostEntry hostEntry = System.Net.Dns.GetHostEntry(u.DnsSafeHost);

                                string newHost = "";
                                foreach (IPAddress ipaddr2 in hostEntry.AddressList)
                                {
                                    // we only want ipv4.. this is just the xbox after all
                                    if (ipaddr2.AddressFamily != System.Net.Sockets.AddressFamily.InterNetworkV6)
                                    {
                                        newHost = ipaddr2.ToString();
                                        break;
                                    }
                                }

                                rtspURL = u.AbsoluteUri.Replace(u.Scheme + "://" + u.Host + "/", u.Scheme + "://" + newHost + "/");

                                if (newHost.Length == 0)
                                {
                                    Log.Debug("TVServerKodi: No IPv4 adress found for '" + u.DnsSafeHost + "' failed. Returning original URL.");
                                    Console.WriteLine("No IPv4 adress found for '" + u.DnsSafeHost + "' failed. Returning original URL.");
                                }
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine("IP resolve for '" + u.DnsSafeHost + "' failed.");
                                Console.WriteLine("Error: " + ex.ToString());
                                Log.Debug("TVServerKodi: IP resolve for '" + u.DnsSafeHost + "' failed.");
                                Log.Debug("TVServerKodi: Error: " + ex.ToString());
                            }
                        }
                    }
                }
                catch
                {
                    //Console.WriteLine("IP resolve failed");
                }

                // update globals
                timeshiftUrl = rtspURL;
                timeshiftChannel.Add(me.Name, chanId);
            }

            Log.Debug("TVServerKodi: PlayChannel " + chanId.ToString() + " => URL=" + rtspURL);
            //Console.WriteLine("PlayChannel result : " + rtspURL);
            return(rtspURL);
        }