Open local video on Android device, from a QR code - android

Background
Some teams in my company's facilities are using Android tablets for multiple operations. We would like to allow them to access video demos from their tablets, when they are at specific places in the facility, without having to search through the tablet for the right video. So we thought of QR codes (printed on paper, stuck to the wall). Problem is: for security reasons, we can't allow the devices to access any network.
Question
So the idea is to store the videos locally, and have the QR code route to the local file. I thought this would be easy but it doesn't appear to be.
I have generated QR codes like file:///path/to/my/file.mp4, also trying to play with intents, like this:
file:///path/to/my/file.mp4#Intent;scheme=file;action=android.intent.action.VIEW;type=video/mp4;end.
(+ variants including intent://, using scheme=file, targeting images instead of videos...)
In the best cases, the browser opens, closes, and I receive "Cannot display file. Invalid PDF", and in the worst cases, "Sorry, the application could not be launched. The bar code content may be invalid.".
I also tried variants (images instead of videos, URL vs plain text QR codes, several code scanner applications), all with the same result. I have searched through SO, but most questions are about doing this programmatically in an application, while I would like to avoid designing an app just for this.
What am I doing wrong? Is there no way to do this that way?
Note: I had absolutely no knowledge about Android and intents before trying to solve this case, there may be smarter workarounds. Any hint is appreciated.

Given the network requirement within your company, it seems building a simple application is the easiest solution(maybe because I am an app developer).
So your app would need only 2 screens. QR code Scanner and a View that shows the video.(once you click done, go back to scanning)
The app can have all the videos you need prebuilt in the app itself and the QR codes can be the names of those videos.

Okay, I don't know if you are using web page or any android app for this fature, for web page you need to create your own scanner or integrate ready made solution i found 1 here, you will need setTimeinterval so it scans bar code once, Once barcode is found you will need to call your ajax method to fetch complete URL of that video, once any item is returned, you need to display it in iframe.
Hope it works for you.

Related

React Native - Open the device default gallery app

I'm developing a camera for a React Native app, and it needs to include a button to open the device gallery app (gallery for android, camera roll for iOS). All photos are stored in a specific album, so it would be better to open the app in that album, if possible, but it's not mandatory. It's worth noting that I don't want to create a custom in-app gallery. That would actually be easier, but it's not what the client asked for.
It seems to be a pretty simple task, but I haven't found a way to do this yet. Some people suggested using linking, like this:
Linking.openURL('content://media/internal/images/media');
This makes the OS ask the user what app should be used to open that link. If I select Google Photos, it works fine. However, if I use the default android gallery, it opens a photo that doesn't exist, showing a placeholder image. So this method doesn't work reliably.
According to android docs, it should be possible to open the gallery app by using an intent. But I tried doing both:
Linking.sendIntent('CATEGORY_APP_GALLERY');
Linking.sendIntent('android.intent.category.APP_GALLERY');
and it didn't work. Either I'm doing something wrong, or sendIntent doesn't work at all.
There's also a plugin called "react-native-send-intent", but it doesn't include a function to open the gallery. I'm running out of ideas, any help would be appreaciated.
I had the same issue in my personal project.
According to the doc, CATEGORY_APP_GALLERY is just specifying app categories and must be used with the ACTION_MAIN action.
As far as I understand, we cannot pass a category via React Native built-in Linking.sendIntent() method, unfortunately. We must rely on third-party libraries on that part.
I picked up expo-intent-launcher (If you are not using expo, still you can use it by following bare workflow as it's described in the doc).
Here is a working snippet example with expo-intent-launcher:
import * as IntentLauncher from 'expo-intent-launcher';
IntentLauncher.startActivityAsync('android.intent.action.MAIN', {
category: 'android.intent.category.APP_GALLERY',
})

TOK BOX Screen sharing is not working outside my app

I did screen sharing (tokbox) for my application.
It works fine inside my app.
But I cannot share screen outside my app...
Can anyone plz help?
https://tokbox.com/developer/guides/screen-sharing/android/
I had also faced the same issue and had mailed to tokbox support.
This was their response:
The way our screen capture code works is that it recursively traverses the view hierarchy and copies those images to a buffer and then send that buffer over on the webrtc data pipe. Hence once the app is pushed to the background, we could not traverse the view hierarchy and copy the image, so screen sharing works until we are in the application (Android or iOS native app). If you want to share the screen view of Opentok app only, it will work but outside the app won't work. It's just to take care of the privacy and security aspects of the mobile app users.
So according to them you cannot share screen outside the application. It will only work when app is in foreground.
Update
After constantly asking the tokbox support team I got the following reply from them:
To screenshare the content outside of your application on Android and iOS can be achieved.
For Android, you need to use the Media Projection API together with Vonage/Tokbox Custom Capturer.
For iOS, you need to use the iOS ReplayKit together with Vonage/Tokbox Custom Capturer.
Basically, the implementation is to get a frame from Media Project API or Replaykit and then pass it via a custom capturer.
Following their response, I found Accelerator Core Android repo which showed how to integrate Media Projection API with tokbox.
More specifically these two files: ScreenSharingFragment.java and ScreenSharingCapturer.java
Using these two files I am now able to share screen outside my application.
Note:
Apps that target Android 9 (API level 28) or higher should use Foreground services or else your app will crash due to security reasons.
According to Tokbox, we can't share the screen outside the application.
Manik here from the Video API team.
To screenshare the contents outside of your application on the Android platform, you need to use the Media Projection API. In combination with the Media Projection API, you need to use a Custom Capturer.
We're working on a sample application that will allow you to accomplish this - please stay tuned!

Implementing youtube bookmarks app on Android

I'd like to implement bookmarks app allowing to save a bookmark for a particular moment in a youtube video so that it would be possible to jump back to the given second of the video.
I'd like it to be seamlessly integrated with the native youtube app. Is it possible to create a transparent layer on top of youtube app so that I could add this kind of functionality? I mean kind of button in the corner of the screen allowing to save the exact moment of the video. To do that I need to know what youtube video is being watched and what is the moment? Is it doable?
I have no experience with android development, but I'm a skilled Java programmer.
This is a link to a youtube video which takes you directly to a certain moment in the video: https://theyoutubevideolink?t=36m42s (Note everything after ?)
This also works on the current Android YouTube App you can click on the link and it will directly take you to the moment. So it is possible to simply save that link to an external overlay/database.
But before thinking about that you understand Root permission is needed to be able to do this as an overlay. If you are fine with this, it is doable there are many open source YouTube apps with changes made to them on XDA Developers for example, and a simple database addition can the trick for this.
[EDIT]
Well I just went on the YouTube app and you cant hold a time-link like for example on LinusTechTips new video on mobile if you scroll down to the comments you will see many comment showing 0:55 which if you click on can take you directly to that moment in the video. Because we cant hold or anything else than just click, You will need to re-write so you can highlight etc.. which is why i mentioned before about having root access since you cant install third party YouTube apps it has to be re-written and just made into another app. To start you off check this re-written YouTube app called SkyTube: https://github.com/ram-on/SkyTube

how to create a thumbnail of a webpage in Qt/QML for android

I am developing an app for android on Qt and i want to have thumbnail previews of webpages on certain items. I have been looking everywhere but I can't really find anything except for one post from Nokia where they build an app that creates thumbnails.
The problem is that this app uses "Qt+= webkitwidgets" which is not supported by android so i need to find another way.
Would there be any other way to create a thumbnail of a webpage besides using these classes:
QWebPage
QWebFrame
QWebSettings
As they are part of the webkitwidgets module
I decided to do the creation of thumbnails in a serverside application. This way the android device is not bothered with these things.

Android: How to use a Android Pad as a customer information Terminal

I want to us an Android-powered Pad as an information terminal for my customers.
The only thing it has to to is to show a HTML5 Webpage.
Therefore,
1. it should not be posiible to show another website (only the local one), should be no problem
it should be only possible to leave the app with a password (how?)
and all buttons should be disabled (that´s hard).
I found out how to set the target for the home button, but maybe there is an existing solution.
Thanks
Christian
I assume you understand the easiest way to do this is to develop an Android native application to show your webpage. This is done by using a WebView, but the support of HTML5 depends on the platform, so if you use any video or audio, you may need some hooks.
Trhough a WebView, you can filter which urls can be opened or not.
And well, I don't think there are many problems on exiting only when a password is entered.
Regarding to number 2, AFAIK, you can let your Activity ("window" of the application) to handle most of keys, but obviously you can't map the power key.
But I have to confess, when you develop an application, you always find some issues... so probably is not that easy as I wrote in these lines... Good luck!

Categories

Resources