Video streaming in react-native using custom API - django

I'm working on a react-native app using expo-av to show videos, and whne I put in source the uri: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4', from google samples, it acutally works, but if I try to put a uri for a video contained in my django media folder, the following error occur:
The server is not correctly configured. - The AVPlayerItem instance has failed with the error code -11850 and domain "AVFoundationErrorDomain".
How can I solve?
Thank you

Related

Video streaming with django API and react-native

I'm working on a react-native app witch contains some videos, and when I put in source the uri: 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4', from google samples, it actually works, but if I try to put a uri for a video contained in my django media folder, the following error occur: The server is not correctly configured. - The AVPlayerItem instance has failed with the error code -11850 and domain "AVFoundationErrorDomain".
How can I solve? Thank you
This is because AVFoundation is using byte range requests which is not supported by Django out of the box.
Add this to your middleware: https://github.com/AidenEllis/DjangoRangeMiddleware
Related: Byte Ranges in Django

django-rest-framework-social-oauth2: error 400 - redirect_uri_mismatch

I've been trying to add google login to my django app following this tutorial:
https://github.com/RealmTeam/django-rest-framework-social-oauth2
By following exactly the instructions, everything works fine in local.
However, when I try to replicate the same on the server, I get the following error on the redirect page of the login:
Error 400: redirect_uri_mismatch
redirect_uri: http://localhost:8000/auth/complete/google-oauth2/
What is strange to me is, in my google developer console, I have set up the correct redirect url in my app, as follows:
https://mydjangoapp.com/auth/complete/google-oauth2/
And I have also put 'mydjangoapp.com' under 'Authorised JavaScript origins'.
So my question is, why google keeps telling me that the redirect url is
http://localhost:8000/auth/complete/google-oauth2/
which is not the one I have set up in the console? Perhaps there is something obvious that I'm missing here. Thank you!
Why google keeps telling me that the redirect url is
Because your application is sending its in your code the app is running on http://localhost:8000 and if you are using a client library its probably adding the rest automatically.
http://localhost:8000/auth/complete/google-oauth2/
The redirect uri must exactly match what you are sending from your application.
You need to add
http://localhost:8000/auth/complete/google-oauth2/
Javascript origin is only needed if your code is using javascript.
This video will show you how to fix the error. Google OAuth2: How the fix redirect_uri_mismatch error. Part 2 server sided web applications.
If you want your code to send https://mydjangoapp.com then your going to have to be running it from https://mydjangoapp.com probably and you may need to figure out how to configure it so that it is running from the correct host.

getting 500 Internal Server Error when hosting website on cyberpanel

I am hosting django application on Cyberpanel. I have created website in cyberpanel and setup my django project. also changed vHost configuration. but in LIST WEBSITES getting this error
No Screenshot Available
500 Internal server Error
here is image
I cant figure out how do I get rid of it
Cyberpanel is using Statically's services to generate screenshots, it seems something wrong with Statically's server. Don't worry, it's not your Cyberpanel's problem.
Statically.io:
https://statically.io/
Demo: (Not working)
https://cdn.statically.io/screenshot/google.com

AWS Cloudfront ERR_CACHE_OPERATION_NOT_SUPPORTED

I'm using AWS Cloudfront to service audio files to user. Recently several user reported that they are unable to play my audio file. A browser refresh is required to make it work if the audio is stuck.
In the Google Chrome console, it outputs
Failed to load resource:
net::ERR_CACHE_OPERATION_NOT_SUPPORTED
I already have a cache settings in my Cloudfront Behavior settings,
Only default settings is on the origin s3 bucket.
CF cache settings
Any suggestion?
I faced the same issue with a cloudfront video failing to load due to this error. I was able to resolve it using javascript like this:
var videoLink = videoControl1.children[0].src; // videoControl1 is the HTML5 video element, should work similarly for audio.
if (!videoControl1.readyState){
videoControl1.children[0].src = videoLink + "?v=" + Math.random();
videoControl1.load();
}
I followed the suggestion from here: https://github.com/igvteam/igv.js/issues/424#issuecomment-336336788
If you are going to change audio/video source dynamically and play that video/audio, you need to load with load() JS function first that resource before playing.

The f4m document contains errors URL missing from media tag

Sorry if this is in the wrong place.
I’ve gone through Amazon’s guide to setting up a live stream using CloudFront and Flash Media Server as described here: http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/LiveStreamingAdobeFMS4.5.html
However, when I get to configuring Flash Media Playback setup I get the following message:
The f4m document contains errors
URL missing from media tag
I copied the LiveHDSManifest value as pasted it in the Video Source field as described. What am I doing wrong?