2

我实现了一个 DLNA 媒体播放器服务器功能。

服务器支持 DMP(Digital Media Player) 搜索功能,XBMC 或 VLC 播放器正常工作。

但是当我在 Microsoft Media Player 中播放视频并尝试寻找稍后的时间位置时,媒体播放器停止了。

我分析了 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");

任何人都可以给我一个关于媒体寻求请求的建议吗?

4

0 回答 0