Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C# by neal ( 12 years ago )
private void RefreshVideos()
        {
             int videoSecti
            int videoSqrt = Convert.ToInt32(Math.Sqrt(videoSections));

            this.Controls.Clear();

            for (int x = 0; x < (videoSqrt); x++)
            {
                for (int y = 0; y < (videoSqrt); y++)
                {
                    string navStr = "";
                    string appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
                        //string filePath = Path.Combine(appPath, "ohdarn.mp4");
                        string filePath = Path.Combine(appPath, "1410973196141.webm");
                    filePath = filePath.Replace("file:\\", "");
                    //filePath = filePath.Replace('\\', '/');
                    //MessageBox.Show(filePath);
                    //\\webm\\
                    WebBrowser wb = new WebBrowser();
                    wb.Name = "WebBrowser" + (x + y);
                    //wb.Navigate("../webm/1410976072424.webm");
                    //MessageBox.Show(wb.Url.ToString());
                    //wb.Url = new Uri(filePath);
                    //wb.Navigate(filePath);
                    //wb.Navigate("<html><head></head><body><video width=\"" + wb.Width + "px\" height=\"" + wb.Height + "px\"><source src=\"" + filePath + "\" type=\"video/webm\"></video></body></html>");
                    navStr += "<html>";
                    navStr += "<head></head>";
                    navStr += "<body>";
                    navStr += "<video width=\"" + wb.Width + "px\" height=\"" + wb.Height + "px\" autoplay>";
                        navStr += "<source src=\"" + filePath + "\" type=\"video/webm\">";
                        //navStr += "<source src=\"" + filePath + "\" type=\"video/mp4\">";
                    navStr += "</video>";
                    navStr += "</body>";
                    navStr += "</html>";
                    //MessageBox.Show(navStr);
                    //wb.Navigate(navStr);
                    //wb.DocumentText = navStr;
                    DisplayHtml(navStr, wb);
                    wb.Height = (this.Height / videoSqrt) - 2;
                    wb.Width = (this.Width / videoSqrt) - 2;
                    wb.Left = (x!=0)?x*wb.Width:0;
                    wb.Top = (y!=0)?y*wb.Height:0;
                    this.Controls.Add(wb);
                }
            }
        }

        private void DisplayHtml(string html, WebBrowser wb)
        {
            wb.Navigate("about:blank");
            if (wb.Document != null)
            {
                wb.Document.Write(string.Empty);
            }
            wb.DocumentText = html;
        }

 

Revise this Paste

Your Name: Code Language: