React Native Upload to YouTube - reactjs

I am trying to upload a video that I take locally using react native camera and then send it to youtube for processing and then want to display that video on a react.js web dashboard.
We have tried using fetch-blob to upload the video and cloud firestore to store the video. We are not sure at a high level on how to go about the uploading to youtube. I know there is upload docs, however can we physically go about uploading straight from our react-native project to youtube, or would we have to upload to a database such as firebase and then use a cloud function to send it to youtube? Has anyone attempted this? The other alternative is that we can upload to S3 and then use AWS cloudstream to play back but that seems like overkill if there is a simple youtube upload that we can use. Do we have to authenticate a user to youtube before it would work? We do not want anyone having to log into a google account. We are hoping just to have an application created with youtube that we can upload to our channel.
Thank you!

Answer
You can absolutely upload a video to YouTube in many different ways. You mentioned a few options and I will line out how those could work for you.
Do we have to authenticate a user to youtube before it would work?
You will have to authenticate to YouTube in order to upload to a YouTube account. You could very well have one account for your app to use and when your users make videos the app could upload them directly to that account. I do highly advise against that though. Google is not very forgiving and the second someone uploads something to violate Google Policies I suspect you will be banned.
That leaves me to believe the best way here would be to use Auth0 to authenticate users and upload to their accounts. Otherwise maybe look into other options.
Possible Options
Option 1
It might be possible to upload all the videos to one YouTube account and make them all private. Then retrieve those videos and play them on your own site. Possibly something like that could work but it is probably a long shot. That could at least keep you from getting banned because of a user violating Google Policies.
Option 2
Another option would be to make one YouTube account. Save the videos to your server when the users creates them from your mobile application. Then have a waiting period for the video to post to YouTube in order for you and your team to have time to approve them.
At least this way you can use YouTube and have one account, but not take the chance of any repercussions from the videos people are posting.
Problem
How to upload a video from your mobile app using React Native to youtube.com
Solution 1
Upload straight from React Native. You can Use the Google APIs to upload directly to youtube. Google has an extensive API. You will have to create a Google API account and make sure to activate the APIs you want to use. Here is some information I found using the Google Javascript API to work with Youtube.
If you go to this link you can see some information on the scopes of this API.
Here is one scope mentioned on that page.
https://www.googleapis.com/auth/youtube.upload
Using Gogoles APIs you can upload videos directly to the youtube account.
Solution 2
The second solution is to post the video to your server, then once it hits the server use some other server side language to interact with Google's API. This could come in handy for other reasons. Like if you are better with a language other than JavaScript. For example Python might be your favorite language. In that case here is a Python Github repo that does just what your trying to do.
You could very well implement the repo mentioned above to your server and post the video you create from your phone to the server. Allowing the Python script to handle posting the video to YouTube.
Side Note
I do not think Firebase or really any database is necessary for the task you are trying to accomplish. Unless there are other requirements to your problem you have not mentioned.

Related

NextJS advice for SSG/SSR and Google Analytics/cookies

I have a NextJS site which is statically generated at build (SSG).
There are two things I need to implement next
Google Analytics
GDPR compliant opt-in cookie options
The first one is easy enough to do, however i'm struggling with making this GDPR compliant.
The issue is I don't have access to cookies at server side when my site is statically generated. This means that without knowing whether the user has consented to cookies at the server, I can't serve (or not serve) the analytics script along with the rest of the page.
Possible solutions:
Handle everything at client side - ask for consent, then dynamically add the GA tag to the <head>. However i'm worried this will negatively effect the analytics, or break it altogether. Does anyone know?
Change my site to be server-side rendered (SSR). I'd love to avoid this if possible. I'm really happy with how fast the site is running with SSG. It's essentially just a basic blog so would be a shame to have to convert for the sake of analytics.
Any other ideas?...
If anyone has experience with this, whether they used Next or Nuxt, etc, your input would be greatly appreciated!
Thanks in advance
Use Google Tag Manager to manage everything, your GA integration and your cookie integration using something like CookieHub for example (How to set up Google Analytics through Google Tag Manager for Next-Js?)
GTM will allow you to trigger the GA script only if the user specified he accepts analytics cookies.
Eitherway you could use Vercel.com built in analytics since your website is using Next.js wich is Vercel's framework.

How to upload in muy website the watson chatbot, please

I already finish the chatbot, but I have no idea of how to upload it to my website, please, help :)
I tried to look for some code to send to the IT developers, but cannot find it :( And the IT guys are too busy, so I'ld like to get the answer by myself so I can send it to them if I'm not able to apply it. Thank you. (Btw: I'm not an IT person... :( )
Where to start?
The dialog / conversation part of your Watson Assistant part chatbot is available as a REST API.
There are several deployment options available. For the more popular choices the Assistant tooling provides integrations. So if you want to access your chatbot through slack, or facebook messenger or on a word press site then look at the documentation as to how - https://cloud.ibm.com/docs/services/assistant?topic=assistant-deploy-integration-add
If you are developing your own application or web-page, then your developers will need to design the User Interface and handle the quirks of your dialog. eg. Decide how to display images, options etc., all from the API, which is essentially only message in, response out - https://cloud.ibm.com/apidocs/assistant-v2#send-user-input-to-assistant. There are samples available for them to base from - eg. https://github.com/watson-developer-cloud/assistant-intermediate
If your website is using Wordpress, there is a very easy way to deploy the chatbot to it using a wordpress plug in - https://wordpress.org/plugins/conversation-watson/

Gmail API Tutorial only returns Labels

I've recently been trying to implement the Javascript quick-start guide on the official Google Dev page, which can be found here:
https://developers.google.com/gmail/api/quickstart/js
The example is meant to read your Gmail inbox and display the last 10 emails on your html page. I've gone through the example but after I grant permissions in my web browser, I only see a list of the "labels" present in my inbox with no emails/email content. I have created a new custom label in my Gmail inbox and this new label is view-able on my html page, which to me suggests that my connection to the Gmail API is fine.
However, I have not used Python like the example suggests. My html file is currently being hosted on 000WebHost so I figured I don't need to use Python. The reason I came to this conclusion is because the tutorial explains that Python is used to host a web server, as I'm using 000WebHost I think I don't need to host this web server.
This could be my issue if I've misunderstood what Python is really needed for here?
Other than that, I'm wondering if there are any other glaringly obvious issues to someone experienced with the gmail API?
Any advice would be appreciated.

How to make Ionic app work with an API written in Laravel but still works offline

I would like to ask how to create an ionic app that talks to Laravel API but still works offline when there's no connection.
Let's say i have to write a quiz mobile app in Ionic and it requests for Laravel API to retrieve the questions as well as store the scores in db.
I'm just starting to learn Ionic and i'm really confused right now on how to approach this.
What confuses me most are:
Does the Ionic source live inside the Laravel source code w/c serves the API?
If i want the Ionic app to be installable, should the Laravel source code be included as well during the compilation process?
Thanks in advance for any help.
Your php or in general server side code is completely independent from your ionic application. If you want your app to work offline you should think about something like fetching a high number of information initially and work with this data without making any additional requests.
However your ionic app does only contain the frontend. You could implement some logic for local storage, but if you want to keep information hidden from the user (e.g. solutions) you have to put that logic on a dedicated server.
In the few details you provided, I can say the Laravel code does not live inside the ionic app. The ionic app is separate from the backend API by Laravel. You are possibly trying for a ReST based architecture where you communicate with your Laravel Server with an API. You need to keep those codes separate.
However without any internet, you won't be able to access those APIs, so you will just be able to show some static data, or you could serve from a DB and show later. For how to use the sqlite db you can look here
In your backend you can have an API like
http://example.com/api/v1/questions/1/
Which will fetch a question with options and if you want the app to have the answer for offline storage you may have that as well. When a user answers, you may check whether you have internet access and send answer and verify if you do, else you may save the answer in your DB and sync when you do have access. You can fetch multiple questions so that a user may answer multiple questions in case he/she will not have internet access.
Hope it helps. :)

Is it possible to deliver digital content to a user's google drive account?

Without using Google Checkout, I would like to provide a link that allows a user to download digital content directly to their Google Drive account. Does anyone have advice on how this might achieved?
We have our own shopping cart system and host my own content.
We simply wish to provide a link to our content that transfers the digital content to the location of the consumer's choosing.
--Charles
We currently don't provide such widgets for web developers. You can however use the REST API to accomplish such a thing.
Please refer to the Drive API Documentation for how to do it server-side. For a client-side application (full JavaScript), you can refer to the StackOverflow answer.
The Drive SDK currently requires applications to be installed in a user's account through the Chrome Web Store; we are actively working on making the story better for users and developers so stay tuned!

Resources