在线播放Video/PDF/JPG

Label1.Text = Play(url, 600, 400);

public string Play(string url, int width, int height)
{
    string strTmp = url.ToLower();
    if (strTmp.EndsWith(".wmv") || strTmp.EndsWith(".mp4") || strTmp.EndsWith(".wma") || strTmp.EndsWith(".pdf") || strTmp.EndsWith(".mov") || strTmp.EndsWith(".jpg"))
    {
        return wmv(url, width, height);
    }
    else
    {
        return "无法识别的文件格式";
    }
}

private string wmv(string url, int width, int height)
{
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    sb.Append(" ");
    sb.Append("showcontrols=1 autostart=1 autorewind=0 ");
    sb.Append("page=3 ");
    sb.Append("playcount=0 moviewindowheight=240 moviewindowwidth=320 ");   
    sb.Append("filename=");
    sb.Append(url);
    sb.Append(" src=");
    sb.Append(url);
    sb.Append(" ");
    return sb.ToString();
}

 

posted @ 2017-05-31 10:38  芈璐  阅读(339)  评论(0编辑  收藏  举报