Vimeo API returns inconsistent CDN URL - vimeo-api

We're using the Vimeo API for a client to play 3 different 360 videos through Android and iOS apps - in some cases we had to make some exceptions in our app to work around special characters in the URL that were causing problems with our player - so we have some code to tidy up the final video URL.
This worked fine, at first, but now it seems as if the Vimeo API is returning different URLs for 2 out of 3 of our videos. Videos from fpdl.vimeocdn.com work fine. They all used this domain when we first created the app. But two of our videos changed to gcs-vimeo.akamaized.net and have a different syntax.
Is this something we can't control? Will the CDN targets change often? Will all 3 of our videos eventually change to the new URL? Before we go back and adjust code again - I need to evaluate if we should just use a different player instead, if this will happen frequently.

Vimeo uses different CDNs to host video files, and those CDNs should not matter to the viewer/enduser.
When getting the direct video file links (either using the API or from the video's Settings page), those links are HTTP 302 redirect links to the actual video file resource. The location of that resource changes every few hours, so always make sure you use the redirect URL provided, and make sure the player being used supports redirects.

Related

manipulation the original source of a file or video url like youtube player or cloud file download sites

if we see big websites like youtube, google drive, facebook, cloud file download sites, etc., then we will find that every link file, video, image or whatever, then the original file link will not be seen for example videos on youtube, even if we inspect the element and see the source on the video player it isn't visible, the link is just written:
src = "https://www.youtube.com/94118230-9dbf-4207-a098-de7a7ccdf7f6"
without any real address or file extension like .mp4 or others. can anyone help explain how to engineer this and whether django can handle engineering like this?
First point: an url doesn't have to point to a file. What happens when some url is requested is up to the HTTP server serving the url. Serving files from the server's filesystem is the basic default for most HTTP servers (static sites), but that's just one of the possibilies, it can as well be executing a CGI script, delegating to a pool of long running processes (typical Python wsgi app), whatever...
Second point: files extensions are mostly cosmetic. You can have a file name without any extension directly served by Apache, and you can have an url with a filename extension that is actually served by some script or other program dynamicall generating content.
IOW, there's absolutely no relation between what the url looks like and how the response is built, and "original file link" doesn't mean anything, and the youtube url you posted IS as much of a "real address" than any other url.
can anyone help explain how to engineer this
It's impossible to answer this question, at least not with a one-size-fits-all answer. If all you want is to serve a static file without extension, just rename the file without the extension, possibly tweak your HTTP server config so that it correctly handles the case, and you're done.
whether django can handle engineering like this
Any techno that is not able to "handle engineering like this" is either prehistoric or fundamentally broken.
I strongy suggest you (seriously) read about the HTTP protocol and learn to set up and configure a standard HTTP server (Apache comes to mind). Only then will it make sense to worry about specific technos (Django or else).

Html5 video in Safari - Django

I'm trying to make a video cross-browser. I have encoded the video with the required codecs etc. When run through the Django server, both Chrome and Firefox show their respective video (Chrome displays the .mp4, and Firefox the .ogv). However Safari can not display the video. I know it is not an encoding problem because when I just open the raw html file and manually move the same video to the right directory, the video loads up just fine. And it's not a referencing error because the mp4 file is being played just fine in Chrome when running the Django development server.
I'm not sure what code I could give, because no errors are being thrown, even in the terminal the request for the video is a green HTTP 200, it just doesn't display. Are there any known errors with deploying videos from django?
I tried hardcoding urls, putting the video in static rather than media, but nothing works.
Versions: Latest of everything.
Edit: I have quicktime installed, which seems to be a the cause of this problem too.
If I right click on the empty video pane and click download video, it downloads the playable mp4 video.
If I copy the video path from the safari video and paste in chrome, the mp4 video plays fine in chrome. And still plays fine in Safari when the raw html is linked to the video.
I am adding the videos into my django uploaded media file through admin, could this be why? (Not sure why it would be given it's just Safari that's not working)
After playing around for a bit I got this error:
OSError: [Errno 41] Protocol wrong type for socket
[27/Mar/2016 05:04:01] "GET /media/media/uploads/SampleVideo25.mp4 HTTP/1.1" 500 59
Another edit:
After seeing many people say that it is just the django development server I deployed my site to Heroku. The same thing occurs. It works in Chrome and Firefox but not in Safari, and when checking the logs it just says it retrieved the video with a Http 200 status.
The only other option I could try is serving the videos through AWS3
This is a common issue for the development server. There are quite a few issues on Django project regarding this one, but I think the following describes the best why it is not addressed:
if we are adding runserver support for something that's not even supported by what I think is a fairly common web server, that seems like it will only encourage more people to use runserver in production.
Relevant issue #22479 but as mentioned above you can find many similar issues that are or could be related to your problem.
You can try to serve video from an outside url during your development, this should be a workaround. At least this is what I have done in the past.
For whatever reason, the video shows just fine when called from the AWS3.

invite user to a dropbox folder using python sdk

In my application I am sharing a set of images from one of my dropbox folder to few people and wrapping some control over it.
Since I am using client.media('path_to_image'), I am getting the exact url and putting it in html as
<img src="the url returned">
, but with an expiry duration.
But it wont be available to other unless the image_path is available in other user's dropbox.
Though the client.share('path_to_image') gives a public url whose expiry date is set too ahead but, the url it returns is shortend one. So I wount be able to use that url in html img tags as src.
So the only way I could short out is to invite the users to my folder so that the image path available in there dropbox client too.
Is there a way to invite users to my dropbox folder, using dropbox python sdk or api.
Any help would be really appreciated.
Thanks in advance.
I'm not sure I understand your problem, or you might be misreading the documentation for client.media(). The URL returned by that API can be used by any user without authentication (until it expires) so it's suitable for use in an tag as you suggest.
If the short URL from client.share(path) is a problem, you can call client.share(path, short_url=False) and get an unshortened URL. The links you get from that call don't lead directly to the image, though, but to a web page on which the image can be viewed or downloaded. You can actually create a direct-download link (unexpiring) from a share link if you replace www.dropbox.com with dl.dropboxusercontent.com in the URL.

audio streaming server

I'm a php developer, trying to develop a website to stream on-demand music to the users.
After a lot of googling I'm confused about which kind of server or tools should I use? I've seen some like WOWZA or SHOUTCAST, but I don't know which one is the best for my needs.
I want to provide high quality audio files. So maybe I should use 320kbps mp3 format or something else but with the same quality.
I don't need live streaming. I just need on-demand streaming of the music files and the ability for the user to create his/her own playlists.
The user shouldn't be able to download the music files.
Icecast/SHOUTcast are not appropriate for your use. They take a single stream and send it to multiple connections simultaneously. They are not "on-demand" servers where each user can listen to separate content.
For your use case, you can implement something in PHP. All you are really doing is sending media files to the client. You mentioned that you wanted to keep the client from downloading those files... this is impossible. If the client can play it, the client can save it, and there is no way around this. However, there are some things you can do that prevent it from being as easy as linking to a file.
Don't store your audio in the web server's document root. All media files should be served only from your PHP scripts. This gives you control over the requests coming in. Look into readfile(). This also allows you an easy path to get off of simply loading files from disk (which you will want when you start to grow beyond 100k media files).
A URL for a media file should only work once, and for a specific user session ID. Generate these URLs on the fly, with a time limit on them. If the URL for the media file is requested by someone who doesn't have a valid session on your site, don't serve it. If the link is expired, don't serve it. This is what prevents someone from getting the URL and posting it on some message board. Only valid users of your site with current valid sessions should be able to get at your media files.
Rate-limit requests. Don't allow a user to be able to download more files at a time than is needed. If they request 100 files in 1 second, don't serve them.
Implementing all of these concepts is something I leave to you. How you do so depends your needs, and is not something that is typically done in a 5-line snippet of code.

keep media in base URL

So, I am looking for a solution to have images through the base website URL.
Example of image url:
www.website.com/image.jpg
Where the homepage lives at the url:
www.website.com/
I am using the django python web framework, and am aware this is a peculiar, if not just bad idea, but my client has linked several hundred images to their base URL in the above format, and refuses to change the existing links.
I know this is a vague question, but I can't seem to find anything relevant. Do I just set the media url to the same as the website?
Why don't you just configure your web server to rewrite the paths?
You could also configure it using an alternate host, assets.example.com for example and serve everything from there. Then you could rewrite all requests going at www.website.com to assets.example.com.