Windows Mobile 应用程序 - 通过 MMS 协议播放流?

发布于 2024-07-27 01:02:25 字数 1848 浏览 4 评论 0原文

注意:这个问题被重新提出是因为我在上一个问题中不小心点击了社区维基,显然这并没有以声誉的形式提供足够的激励来让人们回答这个问题。 这是旧问题的链接,请不要重复这些答案(无论如何它们并不完全有帮助):

链接到原始问题

现在问题是...

我正在尝试编写一个针对 Windows Mobile 6.x 的 Windows Mobile 应用程序,该应用程序将流式传输通过 MMS 协议传送的互联网广播流(仅一个)功能等)。

.NET Compact Framework 是否有内置控件或 API 可以执行此操作? 或者我需要开始寻找第三方库?

我有点困惑为什么 .NET Compact Framework 不支持这一点? 我的意思是 MMS 是 Microsoft 专有的 Windows 流媒体协议。


我实际上也不知道如何通过 http 传输 MP3。 我已经尝试过这个,但没有成功:

一些 MSDN 文章关于使用 WMPLib.dll

事实上,如果我导航到移动设备的 Windows Media Player 本身并为其提供与我尝试以编程方式流式传输相同的 URL,则不会成功。 然而,这个相同的 URL 可以在我的台式计算机上的 Windows Media Player 中使用。 是的,输入正确。

我实际上遇到了另一个想法,即在我的自定义应用程序中在 Windows Mobile 上播放 MP3 文件,但它不具备即时流式传输的能力。 相反,它会先下载整个文件,然后再在移动设备上播放。 这是一些代码:

string url = @"http://blahblah.com/blahblah.mp3";
string tempFilePath = Path.GetTempPath() + "tempFile.mp3";

HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
 byte[] buffer = new byte[1024];
 int bytesRead = 0;

 using (Stream responseStream = response.GetResponseStream())
 {
  using (FileStream fs = new FileStream(tempFilePath, FileMode.Create, FileAccess.ReadWrite))
  {
   while ((bytesRead = responseStream.Read(buffer, 0, buffer.Length)) > 0)
   {
    fs.Write(buffer, 0, bytesRead);
   }
  }
 }
}

SndPlaySync(tempFilePath, 0);

这是 DllImport:

[DllImport("aygshell.dll", SetLastError = true)]
private static extern IntPtr SndPlaySync(string Path, uint Flags);

有人对如何流式传输 MP3 有任何建议吗?

先感谢您。

NOTE: This question is being reasked because I accidentally clicked Community Wiki in the previous one, and obviously that didn't provide enough incentive in the form of reputation for people to answer it. Here is a link to the old question, please do not duplicate those answers (they weren't exactly helpful anyway):

Link to Original Question

Now here's the question...

I'm trying to write a Windows Mobile app targeting Windows Mobile 6.x that will stream an internet radio stream delivered via MMS protocol (just one feature among other things).

Does the .NET Compact Framework have built-in controls or API's that will do this? Or would I need to start looking for a third-party library?

I'm a little confused why this wouldn't be supported in the .NET Compact Framework? I mean MMS is Microsoft's proprietary Windows streaming protocol.


I'm actually not sure how to stream MP3 over http either. I have tried this, but it was unsuccessful:

Some MSDN Article about using WMPLib.dll

In fact, it is unsuccessful if I navigate to the mobile's Windows Media Player itself and give it the same URL I am trying to stream programmatically. However, this same URL does work from the Windows Media Player on my desktop computer. And yes, it is typed in correctly.

I have actually come across another idea to play an MP3 file on Windows Mobile in my custom app, but it doesn't have the ability to stream on the fly. Instead it downloads the entirety of the file before playing it on the mobile device. Here is some code:

string url = @"http://blahblah.com/blahblah.mp3";
string tempFilePath = Path.GetTempPath() + "tempFile.mp3";

HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
 byte[] buffer = new byte[1024];
 int bytesRead = 0;

 using (Stream responseStream = response.GetResponseStream())
 {
  using (FileStream fs = new FileStream(tempFilePath, FileMode.Create, FileAccess.ReadWrite))
  {
   while ((bytesRead = responseStream.Read(buffer, 0, buffer.Length)) > 0)
   {
    fs.Write(buffer, 0, bytesRead);
   }
  }
 }
}

SndPlaySync(tempFilePath, 0);

And here is the DllImport:

[DllImport("aygshell.dll", SetLastError = true)]
private static extern IntPtr SndPlaySync(string Path, uint Flags);

Does anyone have any advice for how to stream the MP3 instead?

Thank you in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

决绝 2024-08-03 01:02:26

据我所知,微软不再支持彩信了!
无论如何,我认为实现 MMS 协议不是问题,您可以采用任何可以接收 MMS 流转储套接字的 Windows(非移动)应用程序,并使用 Socket 类在 Windows Mobile 上执行相同的操作,主要问题是解码接收到的流! 对我来说有2种方法:
a) DirectShow 推送源过滤器,将样本推送到解码器(有时您会遇到设备上不存在所需解码器的情况)
b) 您可以为 windows mobile (CE) 构建 ffmpeg

As i know Microsoft do not support MMS any more!
Anyway, i think it aint problem to implement MMS protocol, You can take any Windows (not mobile) application that can receive MMS stream dump sockets and do the same on windows mobile using Socket class, the main problem will be to decode received stream! There 2 ways as for me:
a) DirectShow push source filter that will push samples to decoder (some times you will got situation that required decoder does not exist on device)
b) You can build ffmpeg for windows mobile (CE)

赠我空喜 2024-08-03 01:02:25

当您使用 MMS 时,有两个选项可以提供您的音乐:

  • 安装 Windows Media Server 并为您的音乐添加发布点
  • 如果您有 IIS 服务器,您需要获取一个 WMS 插件,该插件将允许您通过流式传输 mp3 HTTP

请参阅此链接

请注意,以上两个是当前可用于通过 MMS 提供媒体服务的唯一选项。 如果您有其他 Web 服务器,它将需要一个类似于上面提到的 IIS 插件(不太可能找到)。

完成后,作为 WinMobile 6.x 一部分的 Windows 媒体播放器将能够从服务器调整和播放内容。 客户端 (WinMobile) 不需要任何操作。

When you are using MMS there are two options to the serve your music:

  • install the Windows Media Server and add a publishing point for your music
  • if you have a IIS server, you need to get a WMS plugin that will allow you to stream mp3 over HTTP

Refer to this link.

Note that the above two are the only options currently available to serve media over MMS. If you have some other web server, it will need a plugin like that mentioned above for IIS (not so likely to find).

Once done, the windows media player that comes as part of WinMobile 6.x will be able to tune and play stuff from the server. Nothing required on the client (WinMobile) side.

养猫人 2024-08-03 01:02:25

使用内置媒体播放器时,Windows Mobile 平台上启用 MMS 支持。 启用 MMS 播放的第一个也是最简单的方法是在 Windows Mobile 上生成媒体播放器的实例,并向其传递您需要播放的流的 URL,您已经提到过这样做。 但是,您引用的文章是关于在 Windows 而不是 Windows Mobile 上启动媒体播放器的。 理论上,您应该能够像打开 HTTP 链接一样打开有效的 MMS URL,并且移动设备将自动启动 Windows Media Player。

从开发方面来看,我不知道框架本身有任何允许播放视频流的 .Net 库,但我尚未更新的 Silverlight 库可能是个例外。 这些可能会在今年晚些时候或明年初在移动设备上推出。 由于紧凑框架是主框架的子集,因此我在最近 2 个 SDK 版本中没有看到任何对流的引用。

附带说明一下,将 URL 传递给 Windows Mobile Media Player 时,在 URL 末尾添加 /* 并查看是否可以播放该流。 如果这不起作用,则流式传输方法可能无法提供有效的提要。

我承认我还没有看过新的 Windows Mobile 6.5 SDK,它很可能包含此功能,但是 MSDN 还没有向我透露任何内容。

MMS support is enabled on the Windows Mobile Platform when using the built in Media Player. The first and simplest way to enable the playing of MMS would be to spawn and instance of the Media Player on Windows Mobile and pass it the URL of the stream you need to play, which you already mention doing. However the article your referring to is regarding launching the Media Player on Windows and not Windows Mobile. Theoretically you should be able to open a working MMS URL the same way you would open a HTTP link and the Mobile device will launch Windows Media Player automatically.

From a development aspect I am not aware of any .Net libraries native to the framework that allows the playing of Video Streams, with the possible exception of the Silverlight libraries which I am not up to date with. These would potentially be available for Mobile later this year or early next year. Since the compact framework is a subset of the main framework, I have not seen any references to streaming in the last 2 SDK releases.

As a side-note, when passing the URL to Windows Mobile Media Player add a /* at the end of the URL and see if this plays the stream. If this does not work the method of streaming might not be supplying a valid feed.

I will admit I have not looked at the new Windows Mobile 6.5 SDK and it is very possible it may contain this functionality, however MSDN has not revealed anything to me yet.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文