我实现了DLNA媒体播放器服务器功能。
服务器支持DMP(数字媒体播放器)的搜索功能,XBMC或VLC播放器正常工作。
但是当我在微软媒体播放器中播放视频并试图寻找更晚的时间位置时,媒体播放器就停止了。
我分析了MS Media Player的网络数据包,并试图创建与MS Media Player的DMS(数字媒体服务器)相同的标题。
但我仍然失败了。
我错过了重要的标签信息吗?
我的回复代码如下:
NetworkStream ns = new NetworkStream(mClient.Client);
try
{
StreamWriter sw = new StreamWriter(ns);
if (rangeBegin >= 1)
{
sw.WriteLine("HTTP/1.1 {0}", HttpStatus.Http206);
}
else
{
sw.WriteLine("HTTP/1.1 {0}", HttpStatus.Http200);
}
long k=total_size - rangeBegin;
sw.WriteLine("Content-Length: {0}",k );
sw.WriteLine("Content-Type: " + ContentType);
try
{
String st = HttpRequest.IfUnmodifiedSince;
sw.WriteLine("LAST-MODIFIED: " + st);
}
catch (Exception e)
{
Log(TAG, "Exception:" + e.Message);
}
sw.WriteLine("Server: PegaServer");
sw.WriteLine("Accept-Ranges: bytes");
//sw.WriteLine("ContentFeatures.DLNA.ORG: DLNA.ORG_PN=AVC_MP4_HP_HD_AAC;DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01500000000000000000000000000000");
sw.WriteLine("contentFeatures.dlna.org: DLNA.ORG_PN=AVC_MP4_HP_HD_AAC;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000");
sw.WriteLine("CONTENT-RANGE: bytes " + getContentRange());
sw.WriteLine("transferMode.dlna.org: Streaming");
String date = DateTime.Now.ToString("r");
sw.WriteLine("Date: " + date);
sw.WriteLine("Pragma: no-cache");
sw.WriteLine("Expires: 0");
sw.WriteLine("Cache-Control: no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform, private");
sw.WriteLine("Connection: close");
有人可以向我提出媒体搜索请求的建议吗?