When the SPP functionality of p2pd is used it will typically be necessary to use a media player or browser that does not support SPP to play the streamed video. To make this simpler, there is functionality in p2pd to aid in redirecting requests, without having to modify or recompile any application that already supports HTTP based streaming.
Content providers are assumed to have a normal HTTP server that provides the html required for presentation in a web browser, in addition to a p2pd server to stream the larger video files. In this example, we assume that the web server is located at http://www.example.org, and that the SPP URL for the p2pd server is spp://spp.example.org.
To make the transition between the two easier, p2pd is able to accept requests in HTTP, allowing the web server to link to the file spp://spp.example.org/movie.mpg with the URL http://spp.example.org:1111/movie.mpg. If p2pd is started with the -T option, it will accept this request if the file exists, and return a playlist with the mime type application/x-spp-playlist.
[playlist] numberofentries=2 File1=spp://spp.example.org:1111/movie.mpg Title1=spp url, for supporting clients Length=1234555 File2=http://spp.example.org:1111/movie.mpg Title2=http fallback url Length2=1234555
A client with SPP support will use the first link, a client which only supports HTTP will typically proceed to the second. The p2pd process running on the machine of the user is additionally able to work as an HTTP proxy, accepting requests via HTTP, while actually using SPP to retrieve the content before it is returned to the application as a continuous byte stream. By setting a handler for the mime type application/x-spp-playlist that redirects the request to the cache, the video stream will be downloaded via SPP without having SPP support in either the browser or the media player.
To use mplayer to play video files selected in a normal web browser the script below can be used:
#!/bin/sh - http_proxy=http://localhost:1111 mplayer -playlist "$@"
The environment variable http_proxy is supported by many different HTTP clients, and the script in the example above sets this to point to the port 1111 at localhost, where p2pd is assumed to be running.
With this it should be possible to retrieve data via SPP from many existing applications. Good luck and happy streaming.