Beispiel #1
0
        protected void recordClick(object sender, EventArgs e)
        {
            TaskFactory t = new TaskFactory();

            t.StartNew(() => {
                label1.Text           = "Förbereder Kameran...";
                progressbar1.Fraction = 0;

                GoPro.ExecuteURL("gpControl/command/mode?p=1");

                label1.Text = "Tar bild...";
                System.Threading.Thread.Sleep(100);
                progressbar1.Fraction = 0.1;

                GoPro.ExecuteURL("gpControl/command/shutter?p=1");

                System.Threading.Thread.Sleep(300);
                progressbar1.Fraction = 0.3;
                System.Threading.Thread.Sleep(300);
                progressbar1.Fraction = 0.6;
                label1.Text           = "Sparar bilden...";
                System.Threading.Thread.Sleep(400);
                progressbar1.Fraction = 0.8;

                WebRequest req            = HttpWebRequest.Create("http://10.5.5.9:8080/gp/gpMediaList");
                req.Method                = "GET";
                WebResponse filelist      = req.GetResponse();
                System.IO.StreamReader sr = new System.IO.StreamReader(filelist.GetResponseStream());
                string fileliststring     = sr.ReadToEnd();
                int lastimage             = fileliststring.LastIndexOf('J');
                lastfilename              = fileliststring.Substring(lastimage - 9, 12);
                req.GetResponse().Close();
                progressbar1.Fraction = 0.9;
                label1.Text           = "Laddar hem bilden...";


                WebClient client = new WebClient();
                client.DownloadFile("http://10.5.5.9:8080/videos/DCIM/100GOPRO/" + lastfilename, "lastimg.jpg");
                int wwidth; int wheight;
                this.GetSize(out wwidth, out wheight);
                Gdk.Pixbuf pixbuff    = new Gdk.Pixbuf("lastimg.jpg", wwidth, wwidth * 3 / 4);
                image1.Pixbuf         = pixbuff;
                progressbar1.Fraction = 1;
                label1.Text           = lastfilename.ToString();
            });
        }
Beispiel #2
0
        protected void streamclick(object sender, EventArgs e)
        {
            label1.Text = ("Sätter upp lajvström..");

            GoPro.ExecuteURL("gpControl/execute?p1=gpStream&c1=restart");

            keepalive.Elapsed += Keepalive_Elapsed;

            Process p = new Process();

            p.StartInfo.FileName  = "ffplay";
            p.StartInfo.Arguments = "-window_title \"Lajvström från Kamera!\" -fflags nobuffer udp://:8554";
            p.Start();
            p.EnableRaisingEvents = true;
            p.Exited += stopstream;

            keepalive.Start();
        }
Beispiel #3
0
 protected void stopstream(object sender, EventArgs e)
 {
     keepalive.Stop();
     GoPro.ExecuteURL("gpControl/execute?p1=gpStream&c1=stop");
 }
Beispiel #4
0
 protected void OnButton2Clicked(object sender, EventArgs e)
 {
     var state = GoPro.getState();
 }