Opening real player .rm files from server

Contenu du snippet

For opening a Real Player files (.rm) from the server I constructed a .smil file with a .net handler (.ashx file). The smil (Sychonchronised Multimedia integration Language). All details are found in www.w3.org/TR/REC-smil/

The requirement was opening a real player file and the the adminsitrator gives a start timing and end time for the each individual file.

The codes of the smil file was dynamicaly generated from timestamp (begin and end ) from database in ashx file.

The SMIL file looks like this :
<smil>
<body>
<audio src="URL of xxx.rm file" clip-begin="30s" clip-end="40s"/>
</body>
</smil>

The ashx file in VS 2005 can be added through a handler directly and will have two inbuilt functions...

using System;
using System.Web;

public class PlayList : IHttpHandler {

public void ProcessRequest (HttpContext context) {



try
{

context.Response.Expires = -1;
context.Response.Buffer = false;
context.Response.Clear();
context.Response.ClearContent();
context.Response.ClearHeaders();

string mysmil;
string RMFileName = "filename"


mysmil = "<smil><body><audio src=\"";
mysmil = mysmil + RMFileURL;
mysmil = mysmil + "\"";

// insert the smil file here dynamically with file name begin clip and end clip
//<smil>
//<body>
// <audio src="URL of xxx.rm file" clip-begin="30s" clip-end="40s"/>
//</body>
//</smil>



mysmil = mysmil + "/> </body></smil>";
context.Response.AddHeader("Content-Disposition", "attachment;filename=audio.smil");
context.Response.Write(mysmil);
context.Response.Flush();
}
catch (Exception ex)
{
context.Response.Write(ex.Message);


}





}

public bool IsReusable {
get {
return false;



}
}

}

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.