One of the features that were asked a lot of times on our Telegram groups was the ability to monitor the 3DPrinter via a stream feed.
Since we released the beta version of the AtCore couple weeks ago, we are trying now to get more work done with Atelier.
In our project, Atelier is the interface running above AtCore. So it has a lot of more features than the AtCore TestClient has.
To make the wish of our future users come true, I got the task to create a widget that is able to connect to a camera and stream the video from it, so the user can monitor its 3DPrinter.
On the first try, I was using VLC Qt Lib, and worked wonderfully, in a couple of lines I was able to create the widget and start streaming it. You can check the code on this diff. However, that would add an external dependency that would hurt us on future deploys. And Vlc-Qt is having a lot of changes since they are moving up to the 2.0 version, so with a few pieces of advice, I started to look at QtMultimedia docs.
This should have been the first thing to do, check QtMultimedia docs, and work from there. However, Google gave me Vlc as an option, and since was working just fine, I didn’t look further until the next day.
Based on VideoWidget example of QtMultimedia docs I was able to create the widget. I took me fewer lines than using VLC, however, VLC had a lot of boilerplate to work with videos, making the use of QtMultimedia simpler to the need that we have.
The learning part of this was the look at VLC(The video player) source code, I was wondering how they do to search for local cameras to serve for the video stream. In my widget, I’m serving the user the local cameras that I can found, were I borrowed the code from VLC:
#ifdef Q_OS_LINUX QStringList sources; sources << QString("video*"); _sourceCB->addItems(QDir("/dev/")\ .entryList(sources, QDir::System)\ .replaceInStrings( QRegExp("^"), "v4l2:///dev/")); #endif
Of course, this is a code that only works on Linux, since I’m using Video4Linux to serve the local cameras. The combo box also supports URLs entries for remote streams.
The screenshot below shows the result. Say hi =D
Since I don’t have a 3DPrinter, you are looking at my pretty face =D
Now, we are planning to work on a refactor of all the main window, so the user can control more than one printer, so we need to think in a way to serve the user a workspace to control every instance of AtCore that it may be running.
Until Atelier’s release, we have a lot of work to do, however, I’m glad that we are getting there. Baby steps right?
That’s all folks!