Cast player to Chromecast or android TV - casting

I have a html5 based player in my project.
I want to allow my users to cast it to their TVs.
I find myself totally lost.
What is the difference between casting to Chromecast and android TV?
Do I need different implementation/application for each?
Or if I develop for Chromecast it will work for smart TVs as well?
If I don't want to implement a custom receiver, can I only implement a sender application?
Other then apple, are there smart TVs that are not android based?
How is casting implemented with them?
If I have a hybrid application that runs on ios and on android, what sender application do I need? Do I need a different one for ios and android? Or for hybrid I can also build a hybrid sender?
If there are a simple tutorial for dummies' I would love a link

Just to clarify on terminology before diving in, a Cast Sender is the app that is controlling the video (e.g., your app on a mobile device) and a Cast Receiver is what's actually playing the video typically on a larger device such as a TV.
What is the difference between casting to Chromecast and android TV? Do I need different implementation/application for each? Or if I develop for Chromecast it will work for smart TVs as well?
For normal usage, there's no difference in implementation; it's just a case of where the Cast Receiver is running. You can optionally choose to have a native Android TV application as the receiver, which is called Cast Connect, but that is a relatively new feature. Your standard Cast Receiver can run on a variety of hardware and you don't care about the hardware specifics, just the capabilities (e.g., for determining FHD vs 4K).
If I don't want to implement a custom receiver, can I only implement a sender application?
You have to have a Cast Receiver, but there are two options. You can either implement a Styled Web Receiver (sounds like that's what makes sense in your case and isn't much work) or you can implement a custom receiver. Both are covered on the Web Receiver Overview page.
Other then apple, are there smart TVs that are not android based? How is casting implemented with them?
There are a variety of smart TV platforms aside from Android TV and tvOS, including Tizen, WebOS, and others. Your Cast Receiver will work on any of them that support Cast and you don't need to have any custom logic to support them individually.
If I have a hybrid application that runs on ios and on android, what sender application do I need? Do I need a different one for ios and android? Or for hybrid I can also build a hybrid sender?
You need to implement the Android Sender and iOS Sender apps separately.

Regarding Samsung TV, there's a extension lib called SmartView SDK.
With the Samsung Smart View SDK, you can develop mobile apps that can stream multimedia content from mobile devices to Samsung Smart TVs.
You can refer document here:
https://developer.samsung.com/smarttv/design/smart-view-sdk.html
https://developer.samsung.com/smarttv/develop/extension-libraries/smart-view-sdk/download.html
And official demo here:
https://github.com/SamsungDForum/SmartViewSDKCastVideo

Related

How do I connect my app to bluetooth when multiple coding languages are involved?

Our team wants to create a game. We think c++ should be the language (so we can use Unreal Engine to develop), but we want the game to be multi-platform (game consoles, iPhone, etc.). The game will require bluetooth connections with an external device. What communicates with bluetooth? The c++, or Swift/Java (or whatever is running on the platform)?
My recommendation is to use the native language for each platform. In other words, use C++ as you originally planned, swift for iOS, Java/Kotlin for Android, etc. It might theoretically take you longer to develop, but these native languages will end up being more versatile/powerful, and you will find a lot of resources that help you in your development. That being said, if you wanted a common language with Bluetooth functionality across multiple platforms, then Xamarin is the closest thing to being that. Not sure how much you can use it to develop a game, but it will give you some level of interoperability. Have a look at the links below for more information:-
What is Xamarin
Use C/C++ Libraries with Xamarin
Xamarin vs Native App Development: Pros and Cons
Bluetooth LE for Xamarin

Can I write device driver for iOS in C++?

I came up with a project that requires me to write a driver for a micro-controller connected to an iPhone via the lightning port. Is it possible to write the driver at all, if I don't plan on releasing it to the App Store?
Also, my second question is: What language do I have to use? I'm pretty familiar with C++ and I'm completely new to Apple devices, so I have no idea if I need to use Swift.
It's not possible to write drivers for iOS. The only way to access the port (and Bluetooth classic) is the External Accessory Framework.
Some common accessory features are accessible through other frameworks like Game ControllerFramework. The WWDC2013 Designing Accessories for
iOS and OS X and WWDC2014 lists some of the frameworks you can use to interact with accessories.
You need MFi as a hardware vendor and for the AppStore (you need to provide your custom protocol string/s, if any). The program provides detailed information about the iPod Accessory Protocol (iAP).
Maybe you can find this SO question useful USB-Programming on iPhone

Running a Qt app over the web

I am writing an application using Qt and want to try and deploy it as a web-application. I want user's to be able to use my application by accessing it through a web browser. I'm guessing that's what a web-application is? What kind of options do I have? I've never looked into doing anything like this but I'd like to learn something new.
EDIT: What if I deployed my application on a Linux server and had users access/run it through a terminal? I think writing web application is going to be more complicated than I had originally thought.
If all you have is a Qt application, then the best you can do is use Qt 5 and run it using a remote visualization package:
Use WebGL streaming, introduced in Qt 5.10. Qt exposes a browser-connectible interface directly, without need for third-party code.
For Qt 5.0-5.9, you can use the vnc platform plugin. Then connect using a web-browser based vnc client.
For many uses it might be sufficient, and certainly it's much less effort than coding up a web app.
You're looking for Wt which provides a different set of drawing routines for many Qt GUI elements, turning them from lines on screen to HTML controls.
http://www.webtoolkit.eu/wt
It also handles websocket calls to provide interactivity. It seems a great idea, let us know how it works in practice.
For the case of QML there is QmlWeb which is a JavaScript library that is able to parse QML-code and create a website out of it using normal HTML/DOM elements and absolute positions within CSS, translating the QML properties into CSS properties.
QmlWeb is a small project by Lauri Paimen that he’s already developing for a few years now. QmlWeb of course doesn’t yet support everything Qt’s implementation of QML does, but it already supports a quite usable subset of it. It supports nearly all of the most basic QML syntax. Moreover it has support for HTML input elements (Button, TextInput, TextArea are currently supported, more to come).
Well, QmlWeb is not finished. I hope Digia help with this project to make it ready with mature features.
Interestingly, it is possible to compile Qt applications to javascript using emscripten-qt. These run fairly fast with Firefox's asm.js interpreter:
http://vps2.etotheipiplusone.com:30176/redmine/projects/emscripten-qt/wiki
Try "Qt for Webassembly".
Webassembly allows the C/C++ code to be compiled and run natively inside majority of the browsers:
WebAssembly (Wasm, WA) is a web standard that defines a binary format and a corresponding assembly-like text format for executable code in Web pages. ... It is executed in a sandbox in the web browser after a verification step. Programs can be compiled from high-level languages into Wasm modules and loaded as libraries from within JavaScript applets ... Its initial aim is to support compilation from C and C++, though support for other source languages such as Rust and .NET languages is also emerging.
To run a Qt application unchanged over the web so users can operate it in a browser, you can compile it for Android using the x86 Android ABI, run it inside an Android emulator on a server and supply the Android Cast videostream to users' browsers. You'll also need to have JavaScript in place that records the keyboard and mouse events on the web clients and relays them back to the server.
I had previously tried Qt WebGL streaming and found it to be good over the local network but too slow over the Internet. A 10 s application startup time is acceptable, but 3 s to show a new screen is rather not. I had the exact same experience with the Qt VNC platform plugin. Compared with that, the Android Cast streaming based appetize.io solution (see below) was much faster, providing a well usable user experience even over my 8 Mbit/s connection.
Existing solutions
Here is an overview of commercial products and open source software components that I found that can help you with this approach:
appetize.io. This is a commercial product to run Android applications over the web for demo and testing purposes. I have just done this with a Qt QML based application and liked the outcome. When choosing an Android 9 / 10 device you can see that the "Screencast" setting is on; which is why I believe that this solution uses the Android Cast technology.
runthatapp.com. This is another commercial offer. Not as sophisticated (yet) as appetize.io, but providing a nice pay-as-you-go scheme.
ScreenStream. An open source Android app that provides a web server to view the screen of one Android device in a web browser, also relying on the Android Cast technology. That Android device could be an emulator running on a web server. And to make this multi-user capable you can employ a small load balancer similar to a technique that I developed for Qt WebGL streaming. The ScreenStream README shows that the application might consume up to 20 Mbit/s per client in short bursts.
Ideas for future improvements
Serving your Qt app as an interactive live video stream seems a promising idea to me, given that I found it already less sluggish than VNC and similar solutions. There are ways to make this even faster, such as using a hardware H.265 video encoder to create a video stream with very little delay. By operating multiple such encoders on a single server, the server could serve multiple clients and still keep its CPU load low. Maybe there are even better video formats for such a purpose, given that user interfaces of programs lend themselves well to lossless compression.
Some hints for appetize.io
Finally: since I used the appetize.io product for a Qt application over the last few days, here are some tips from that experience:
It is necessary to compile your Qt application for the x86 Android ABI. The default armeabi-v7a ABI will not work because most appetize.io devices are actually server-based Android emulators and the only ARM based device ("Nexus 5 Physical") failed to start any Qt application I tried to use with it.
The x86_64 ABI may also work, but you might then have to also compile Qt yourself for it, as not all versions of Qt come pre-compiled for that architecture.
All appetize.io links (both for standalone pages and embeddable iframes) support GET parameters to configure the app presentation format. Especially relevant here is screenOnly=true to show the app without a picture of a phone or tablet around it.
Features that rely on phone hardware (camera, position etc.) will not work or only show dummy data. But if you really wanted, you could create a hybrid application combined with client-side JavaScript. It would run device-dependent code in the user's browser, for example to take a photo with the webcam, and then provide the results to the Qt application via the appetize.io cross-document messaging protocol. The following message types seem suitable to build a simple communication protocol: pasteText(value), keypress(key, shiftKey) and openUrl(value).
In the default appetize.io standalone app demo pages, only the key events of ordinary letter keys are sent to the app, not keyboard shortcuts or function keys like F2 and Esc. This might be possible to fix with JavaScript on an own page embedding the appetize.io iframe, as their cross-document messaging protocol provides the keypress(key, shiftKey) message type.
Qt does not support writing browser based web applications. Unfortunately.
You need to use common web programming technologies for this. There are a lot of ways, but Qt is not one of them.

Is it possible to write C++ app for Samsung Smart TV with access to USB device

Is there an easy howto on writing C++ app for Samsung Smart TV that should be able to run in background (so not an HTML/JS applet) and access /dev/ttyUSBx device plugged in the TV?
Do they have some API to access /dev/ttyUSBx or it will be a simple Linux app? Do they allow to load such apps? Is there a toolchain to compile such apps?
At least according to Samsung, "No."
Q: Do you support C++ in the SDK?
A: No, Samsung platform only supports web technologies based apps (JS, CSS, HTML, FLASH)
http://www.samsungdforum.com/Support/FAQList?page=1&faqCateID=2
In the SDK 4.5 will include Native Client technology, NaCl, Currently supported languages ​​are C and C + +. For more information: http://www.samsungdforum.com/Guide/d17/index.html
For Samsung SmartTVs you cannot use C++, the only allowed language/technology is HTML/JavaScript/CSS and Flash (not used much).
Majority of the applications are JavaScript based.
Might be you can have some exclusive agreement with the Samsung, since e.g. Skype is most probably not developed in JavaScript and the AngryBirds I heard are C++ as well.
BR
STeN

Windows Mobile 6.5 Change the camera focus

I have a project to scan some QR-code or bar-code with camera on windows mobile. (phone x01t)
Programing in C++ and using DirectShow.
Tired to change focus with IAMCameraControl interface, but return the error like "...request is not supported".
Are there any way else?
Thanks
Most (if not all) Windows Mobile phones I've used so far used custom camera drivers, which means OEMs decide which functionalities to implement/support. IAMCameraControl is most likely not one of them.
However, you might want to look for OEM-specific SDKs. For instance, Samsung provides custom APIs enabling to change such parameters as camera focus or ISO. Maybe such APIs exist for your device.