zoukankan      html  css  js  c++  java
  • 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播放器还是用不起来。

    特说明一下。

  • 相关阅读:
    php7安装Memcached扩展
    php7安装
    结束进程
    openssl 编译
    boost 编译
    php 与 c++ openssl 加密通信
    iptables 端口转发
    获取进程及父进程的两种方式
    windows 下获取父进程pid
    CentOS 64位系统 yum安装32位软件包的方法
  • 原文地址:https://www.cnblogs.com/superch0054/p/4010272.html
Copyright © 2011-2022 走看看