GoPro.Hero
GoPro.Hero copied to clipboard
Write a sample application
Write a Sample WPF application based on provided functionalities by the library
Hi r1pper, did you manage to write sample WPF application? Is there a DLL file that this C# library uses? I'm trying to either use WPF or just winforms in C# to start / stop recording (via USB cable) in the GoPro Hero 3 white edition. Is this possible? Can you explain how to do this please.
Many thanks,
Neo
Hi Neo, I'm actually working on the sample WPF application and soon will commit it, I don't think it's possible to control the camera via USB without any hacks, as far as I know (and what this library is based on) you can control Hero 3 cameras via Wifi based on GoPro App protocol (used in GoPro mobile apps).
The library is a complete implementation of Wifi GoPro Protocol in PCL format and its only dependency is TidyNetProtable which is included in the source. here is an example for recording a video:
using System.Threading;
using GoPro.Hero.Api;
using GoPro.Hero.Api.Hero3;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Gopro Video Record Sample");
var camera = Camera.Create<Hero3Camera>("10.5.5.9"); //address of the camera, default is 10.5.5.9
PowerUp(camera);
camera
.Mode(Mode.Video)
.OpenShutter();
Console.Write("Press any key to stop recording...");
Console.ReadKey();
camera.CloseShutter();
}
private static void PowerUp(Hero3Camera camera)
{
var powerOn = false;
camera.Power(out powerOn);
if (!powerOn)
{
Console.WriteLine("Powering Up Camera...");
camera.PowerOn();
Thread.Sleep(5000); //waiting for camera to get ready
}
}
}
I hope this helps
I try my best to add documentation and sample application as soon as possible. Please feel free to contact me if you have any questions.
Best regards
ripper
Hi ripper,
Thanks for your reply. This info is very useful to me so thanks for sharing it. Yes after posting this question yesterday I found out that its not possible to record while the camera is plugged into the computer via USB. So it will have to be WiFi.
I've seen a few projects that just send HTTP web requests to the camera's Cherokee web server but your solution seems to be the most complete and comprehensive, particularly for WPF.
Looking forward to your sample application and thanks again for your help.
Best regards,
Shivy
On 05/09/2013, at 7:18 AM, r1pper [email protected] wrote:
Hi Neo, I'm actually working on the sample WPF application and soon will commit it, I don't think it's possible to control the camera via USB without any hacks, as far as I know (and what this library is based on) you can control Hero 3 cameras via Wifi based on GoPro App protocol (used in GoPro mobile apps).
The library is a complete implementation of Wifi GoPro Protocol in PCL format and its only dependency is TidyNetProtable which is included in the source. here is an example for recording a video:
using System.Threading; using GoPro.Hero.Api; using GoPro.Hero.Api.Hero3; class Program { static void Main(string[] args) { Console.WriteLine("Gopro Video Record Sample"); var camera = Camera.Create<Hero3Camera>("10.5.5.9"); //address of the camera, default is 10.5.5.9 PowerUp(camera); camera .Mode(Mode.Video) .OpenShutter(); Console.Write("Press any key to stop recording..."); Console.ReadKey(); camera.CloseShutter(); } private static void PowerUp(Hero3Camera camera) { var powerOn = false; camera.Power(out powerOn); if (!powerOn) { Console.WriteLine("Powering Up Camera..."); camera.PowerOn(); Thread.Sleep(5000); //waiting for camera to get ready } } }
I hope this helps
I try my best to add documentation and sample application as soon as possible. Please feel free to contact me if you have any questions.
Best regards
ripper
— Reply to this email directly or view it on GitHub.
Hi r1pper! My team has to develope a solution for scanning barcodes in a warehouse with difficult to reach "targets". Therefor we'd like to use a gopro hero which provides a livestream to a tablet, then we want to take a screenshot and analyze it for barcode. That's the idea. In fact we have a huge problem to get a stable and fluent stream from our hero (like in the gopro app). Can we use your library to get a stream? I saw the livepreview-properties - but how can we use it to show the stream on the screen?
Many thanks,
Raik
Hello Raik
The library can be used to control camera functionality, video streaming is very platform dependent and I believe it should be developed as a separate layer on top of the API, However you can use the m3u8 Parser to download and cache specified parts and play them which is what Go Pro does based on my findings.
Best Regards
Hessam
Hello,
Did you ever write that WPF sample application? If so, could you provide it?
Thank you and best regards, Thaine Norris
Hi @ThaineNorris
Unfortunately, I never had enough time to finish the WPF sample, however the test cases are complete and you can check them for library usage and features, if you need more information or help in usage, I'd be glad to help.
Best Regards Hessam
Hi Hessam,
Thank you for your reply and for working on this project!
Unfortunately, I have not been able to get the project to build at all. I am on Windows 8 with VS 2013 Professional. The PCL libraries are not supported in VS 2013 as they are configured. I removed the Silverlight compatibility and then they would compile. But then many of the System.Reflection things are no longer supported or are very different, and so it won’t build.
At some point I hope to be able to wrap my mind around your code structure and see if I can update it. But it sure would be faster if you did. 😊
Best regards,
Thaine Norris
Sent from Windows Mail
From: r1pper Sent: Thursday, October 2, 2014 11:09 PM To: r1pper/GoPro.Hero Cc: Thaine Norris
Hi @ThaineNorris
Unfortunately, I never had enough time to finish the WPF sample, however the test cases are complete and you can check them for library usage and features, if you need more information or help in usage, I'd be glad to help.
Best Regards Hessam
— Reply to this email directly or view it on GitHub.
Hi @ThaineNorris
you are right, I developed the library using Visual studio 2012,
for Visual studio 2013 professional or Higher you can:
1- Update Nuget package Manager (from Tools -> Extensions and Updates)
2- Type Update-Package
in package manager console
3- Clean Solution
4-Build
5-run some simple unit test like CheckSpotMeter
to verify the library
5-Remember some projects may need Microsoft.Bcl.Build
from Nuget
I try to update the repository for VS 2013 as soon as I can.
Best Regards
Thank you! That did solve the build problems.
Sent from Windows Mail
From: r1pper Sent: Friday, October 3, 2014 11:19 AM To: r1pper/GoPro.Hero Cc: Thaine Norris
Hi @ThaineNorris
you are right, I developed the library using Visual studio 2012,
for Visual studio 2013 professional or Higher you can:
1- Update Nuget package Manager (from Tools -> Extensions and Updates) 2- Type Update-Package in package manager console 3- Clean Solution 4-Build 5-run some simple unit test like CheckSpotMeter to verify the library 5-Remember some projects may need Microsoft.Bcl.Build from Nuget
I try to update the repository for VS 2013 as soon as I can.
Best Regards
— Reply to this email directly or view it on GitHub.
Great library. I created a wpf app and it seems to deadlock at calling async methods from Contents() extension
using GoPro.Hero.Hero3; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes;
namespace GoPro.Hero.Wpf
{
///
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private static Hero3Camera camera;
public MainWindow()
{
InitializeComponent();
getCamera();
}
private async void getCamera()
{
camera = await Camera.CreateAsync<Hero3Camera>("10.5.5.9");
//code deadlocks at following line
var video = camera.Contents().VideosAsync().Result.FirstOrDefault();
}
}
}
Hi @rotosonic
You should either call it from another thread, or set request mode to sync
GoPro.Hero.Configuration.CommandRequestMode = GoPro.Hero.Configuration.HttpRequestMode.Sync
I don't have access to my camera at the moment so I'm not sure but I think using await
instead of Result
may solve the problem too.