• 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播放器还是用不起来。

    特说明一下。

  • 相关阅读:
    Iconfont在Vue中的使用
    yarn安装依赖报错
    动漫
    伤痛的魅力。绷带男子特辑
    记STM32F103C8T6+STLINK下载器在Keil中的设置
    JQuery浮动对象插件
    树莓派RTL8723BU_LINUX驱动安装
    python虚拟环境相关设置备忘
    解决树莓派控制台命令行乱码
    python模块wifi使用小记
  • 原文地址:https://www.cnblogs.com/riskyer/p/3241626.html
Copyright © 2020-2023  润新知