(legacy) Getting a direct link to a movie
Note that the XML-RPC API is a legacy API and is no longer being developed, we recommend using the REST API instead.
As an API developer, you might occassionally want to provide your end users with a direct download link to the media provided by the Screen9 platform. Fortunately, there is a convenient way to do so with the getMediaContentURL function.
Note: This function is not available in the Ajax API.
By calling this with the proper common and mediaid arguments, a string will be returned to you that can be inserted into a link element of your choice. If you only want the download link to last for a short while, supplying a non-zero value to the period argument will make the link valid for that many seconds: Otherwise the validity is eternal. Supplying a trackerid will let you track that particular download link in the statistics. Supply a zero if you do not desire to do any statistics gathering of that particular link (as opposed to other download links you might request).
For more advanced options, we have the following that go in the options struct:
- filename: The default filename on disk provided by the browser for the URL may be clunky, impersonal, or just plain ugly. If you supply this option, you can override it with whatever you feel is fitting.
- protocol: Can be set to RTMP or HTTP (default). Decides what protocol should be used for downloading the links. For general browser usage, you want this to be HTTP.
- userip: Lock this download to this given address, given in the format "1.2.3.4", i.e. as a period-delimited string.
Example usage (in Python):
import xmlrpclib
server = xmlrpclib.Server("http://csp.screen9.com:7777") common = {'custid': YOUR_CUSTID, ...} # Be sure to populate this! url = server.getMediaContentURL(common, "MEDIAID_OF_WANTED_MEDIA", 0, 0,
{"filename": "My nice media.mp4"}) # No special tracking, URL valid for all time