windows media player 中播放pls的方法

windows media player目前只能播放 wpl 和 asm格式的列表文件。而linux下mplayer和vlc支持的pls,很遗憾没法支持。

不过,老外写了个“open pls in wmp”的插件,安装后就可以播放了。就是这个OpenPlsInWmp2Setup.exe

http://openplsinwmp.codeplex.com/

看起来挺酷,不过看一下代码就知道原理很简单。

using System;
using System.IO;

namespace Jon.Galloway.Wrote.Me
{
    class OpenPlsInWM
    {
        [STAThread]
        static void Main(string[] args)
        {
            if (args.GetUpperBound(0) > -1)
            {
                string filename = args[0];
                using (StreamReader sr = new StreamReader(filename)) 
                {
                    string line;
                    while ((line = sr.ReadLine()) != null) 
                    {
                        if (line.ToLower().StartsWith("file1="))
                        {
                            string url = line.Split('=')[1];
                            System.Diagnostics.Process.Start("wmplayer.exe",url);
                            break;
                        }
                    }
                }
            }
            else
            {
                Console.WriteLine("Usage: OpenPlsInWM \"playlist.pls\"");
                Console.WriteLine("Associate PLS file extension with this application to allow Windows Media Player to play them.");
            }
        }
    }
}


因为pls文件格式非常简单, 每行读取到目标文件名后,调用wmplayer.exe来触发就可以了。

 

所以说,这个只能windows media player本身使用。如果是IE嵌入的windows media player播放器还是用不起来。

 

特说明一下。

 

转载于:https://www.cnblogs.com/superch0054/p/4010272.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值