generate URL for mpd videos - url

I hope that I am posting using the right tags.
I added the dash.js player to a page in my website
I did create some mpd files from mp4 ones.
I wanted to know how can I generate URL for these files so that my app can access them.
In case it will help I am using Apache2 to serve my application.

The mpd file provides an index with pointers to the individual steams for your video - e.g. the different bitrate video files, the Audi stream, and subtitles etc.
The pointers in the mpd file are relative or absolute URL's which the client, e.g. the browser can access.
To allow the browser access the mpd itself you just have to put it someplace in your server file structure that clients can access, or that the server will redirect client requests for video to.
The online apache documentation provides an overview of how you can match URL requests to file locations:
https://httpd.apache.org/docs/trunk/urlmapping.html

Related

How to load my local mpd(mpeg-dash) file to online players?

I am trying to use some online players to test my local mpd file, but it could't be loaded as 'file:///path-to-file' form like local urls, what's the correct format to load the file? Or should I upload it online or so?
DASH is designed to be streamed from a server so the player will be expecting to send requests for the mpd and for each media chunk to a server which will respond with the mpd or corresponding chunk.
The mpd is the 'index file' or manifest for the individual video and audio streams.
If you want to test locally then this is definitely possible and the easiest way is to set up a local test server and stream from there. You will need to create the mpd and the chunked media streams and make them available on your server, but it sounds like you have already these created.
You can then point your test player to your local server. Remember to ensure the server serves the streams using HTTPS as this is required by most players and browsers now.
There are a good set of step by step instructions available from Mozilla: https://developer.mozilla.org/en-US/docs/Web/Media/DASH_Adaptive_Streaming_for_HTML_5_Video

Twilio: How to get the call record mp3 file?

I am using this API for getting Twilio call logs. Some of the calls are recorded, so I need to get the corresponding mp3 file. Under the subresource_uris section I found recordings, but it is a .json file.
How can I get the mp3 file link of call records? I am using c# codes.
The .json is to retrieve the metadata.
If you want to retrieve the actual recording leave out the .json (will deliver .wav) or add a .mp3, i.e. https://api.twilio.com/2010-04-01/Accounts/ACXXXXX.../Recordings/REXXXXX....mp3.
See also the Twilio documentation "Fetch a recording media file".
The Twilio media URLs should be public by default, see "Fetch a Recording resource":
Because the URLs that host individual recordings are useful for many external applications, they are public and do not require HTTP Basic Auth to access.
However you can turn on HTTP Basic Auth via the settings:

Are friendly URLs based on directories?

I've been reading many articles about SEO and investigating how to improve my site. I found an article that said that having friendly URLs help online indexers to find and positionate your site better than using URLs with lots of GET parameters so I decided to adapt my site to this kind of URL. I've also read that there's a way (editing .htaccess) but it's not the best way and it doesn't look really good.
For example, that's how Google's About URL looks like:
https://www.google.com/search/about/es/
When surfing into FTP do they see the directories search/about/es/index.html? If so, you must create many files and directories for each language instead of using &l=es, is it that worth?
You can never know (for sure) how resources are mapped to URLs.
For example, the URL https://www.google.com/search/about/es/ could
point to the HTML file /search/about/es/index.html
point to the HTML file /foo/bar/1.html
point to the PHP script /index.php
point to the PHP script /search.php?title=about&lang=es
point to the document available from the URL https://internal.google.com/1238
…
It’s always the server that, given the URL from the request, decides which resource to deliver. Unless you have access to the server, you can’t know how. (Even if a URL ends with .php, it’s not necessarily the case that PHP is involved at all.)
The server could look for a file that physically exists (if URL rewriting is involved: even in "other" places than what the URL path suggests), the server could run a script that generates a document on the fly (e.g., taking the content from your database), the server could output the file available from another URL, etc.
Related Wikipedia articles:
Rewrite engine
Web framework: URL mapping
Front controller

How to stream an audio file without a direct link

I have a rails web app sitting on an nginx web server. I have some audio files on my server, and I want people to be able to listen to them, and to be able to seek to any part of the audio file to listen from that point.
Simple right?
I was using direct links in the src of my html5 audio element. It worked great. The file could be played and seeking worked.
Enter security and auditability.
My audio files are sensitive. I only want certain people to be able to listen to them. I also need to know each time that they listen to them. Suddenly the public directory isn't going to work.
Enter rails's send_file.
Send_file initially appeared to be exactly what I needed. It allows rails to serve my audio files, and I could keep my files in a protected directory, I could check the current user's permissions, and I could create the appropriate audit trail. Except...
With send_file I can't seek. That is a deal breaker.
A few stackoverflow questions address getting send_file to handle http-range/byte-range requests. The ones I reviewed are:
what is the proper way to serve mp4 files through rails...
rails media file stream accept byte range request through send file ...
After doing more research, I found the following blog post:
https://blog.echoplex.us/2014/08/19/so-you-want-to-stream-videoaudio-with-rails/
tl;dr
don't use rails send_file to serve media. don't try to make it like the stackoverflow questions say you can. Instead, use nginx and X-Accel-Redirect, and end up with a request pipeline that looks like you->nginx->rails->nginx->you
I am considering taking his approach, but didn't know if there was a better way to do this.
What are my options?
(also, you can assume that I'm using the current versions of rails and nginx)
DON'T USE sendfile please. Use X-Accel-Redirect or the advice below.
Nginx secure_link module helps you to serve files straight from disk with private links. No backend required. The full example is here.

Rails, given an AWS S3 URL, how to use a controller to send_data / file to the requestor

Given an Amazon S3 URL, or any URL that is a direct URL to a file. In my controller, given this URL, I want to send the user the file, whatever it is w/o redirecting.
Is this possible?
If I understand your question correctly, I don't think that's possible from your end. That's why many sites say "right click to save" or something along those lines. Some sites even have links to videos that say "click to download" but when I click the link they start streaming. These are due to MY settings (ie. the settings on the user's client). You can't control that.
If what you're trying to do is HIDE the location of a file...
Send files back to the user - Usually,
static files can be retrieved by using
the direct URL and circumventing your
Rails application. In some situations,
however, it can be useful to hide the
true location of files, particularly
if you're sending something of value
(e-books, for example). It may be
essential to only send files to logged
in users too. send_file makes it
possible. It sends files in 4096 byte
chunks, so even large files can be
sent without slowing the system down.
From an old blog post

Resources