VODServer Services

If you are lucky, VODServer may already support your favorite streaming video service. The best way to try is with http://vodserver:port/playFromPage?url=url to page containing video. This will try to find streaming video information in the specified page; if it finds video information then it will try to stream it. If this doesn't work, you will probably need to create your own service configuration; see the following sections for more details.

Gathering information

The main task will be to gather information on how the video is being loaded on the web page; you can then mimic this behavior using VODServer ParamBuilders. Depending on the site, the web page may contain a simple video link, or more advanced Flash Player based streaming. The video URL and other information may change regularly, and the site may even use security tokens, trying to prevent people from accessing video streams directly. The good thing is that VODServer is very flexible and can support many scenarios. The bad thing is that it may take some time to figure out exactly how the video is being loaded; the security measures on some pages may prevent you from successfully creating a service.

There is no single way to gather all required information; below are some hints. Usually it is easiest to start looking at the log output for http://vodserver:port/playFromPage?url=url to page containing video.

  • If the /playFromPage service doesn't find video information, it will log the page contents, so you can look at these contents to see whether you can manually find video-related information. If it does find video information but is unable to stream it, you may need to pass additional options. For example, RTMP-based video streams may require a security token. Again, manually analyze the page to figure out how this token is being generated.
  • For RTMP-based flash videos, try to access the site via rtmpexplorer or a similar tool (search the internet for such tools). If rtmpexplorer is able to download the video, look at the rtmpdump command that was generated. Then check whether you can find the various rtmpdump parameter values in the web page source, and use ParamBuilders with regular expressions to have VODServer automatically extract these parameters from the web page.
  • Be aware that many sites perform checks on the HTTP headers that are sent from the client (i.e. VODServer). For example, many sites check whether the Referer header corresponds to a relevant page on their own site.
  • Be aware that the URL that you see in the title bar may not be the actual URL for the page containing the video. For example, many sites use iframe's to load the actual video content.
  • To figure out in detail what is going on, you can use the Chrome Developer Tools or similar tools for your favorite browser. Using these tools, you can figure out exactly what happens when you request a video page. For example, which headers are being sent back and forth, does the page contain iframe's, does it contain an embedded (flash or other) video player, what URL is being called to generate a security token, etcetera.

Once you have figured out the necessary information, it is usually best to first try running rtmpdump and/or ffmpeg manually, to check whether you are actually able to access the video content using the information you gathered. Once this succeeds, you are ready to create a new service configuration.

Basic Service Configuration

Every VODService service is defined in a vodserver-service-name.xml configuration file. Services usually are defiend using the following skeleton:

<bean id="/<service name>" parent="paramBuilderServiceBase" class="<service class>">
        <property name="...">...</property>
        ...
</bean>

Here, service name is the name that is used to invoke the service. I.e. the service can be invoked using http://vodserver:port/service name. Note that in the service configuration, the service name should always start with a forward slash.

service class is the Java class that processes the service request. Please refer to the Service API Documentation for more information on available service implementations.

The parent attribute is used to inherit properties from a parent bean, and is optional. In this example, paramBuilderServiceBase will contain the static parameter definitions from vodserver-services-common.xml, as well as a RequestParamBuilder used to map request parameters to VODServer parameters.

For detailed information on how to configure services, please have a look at the API documentation, and use the predefined services as examples.

Referencing elements from other configuration files

Since VODServer combines all configuration files into a single run-time configuration, services can reference elements (beans) defined in other configuration file. In particular, services can reference elements from vodserver-services-common.xml. For example, most services will reference the static parameter and request parameter builders defined in vodserver-services-common.xml as follows:

<bean id="/play" class="vodserver.service.CommandRunnerService">
        <property name="paramBuilders">
                <list>
                        <!-- Include static parameters from common-->
                        <ref bean="staticParams"/>
                        
                        <!-- Include request parameter builder from common -->
                        <ref bean="requestParamBuilder"/>
                        
                        ...
                </list>
        </property>
        ...
</bean>