在下载时播放mp3文件 [英] Play mp3 file while it's downloading

查看:80
本文介绍了在下载时播放mp3文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不等待完全下载的情况下在互联网上播放mp3文件?

解决方案

你听说过术语流吗?您可以从互联网流式传输音频,然后播放已经流式传输(下载)的媒体部分,这取决于网络速度和CPU速度(CPU将下载的内容放入缓冲区的速度有多快,以便你的应用程序可以工作)。



您可以使用多个类和命名空间。例如,可以将System.IO.Stream作为示例,您可以下载流的字节,然后将它们转换为您的特定文件格式来播放它们。



给这个另一篇文章 [ ^ ]尝试,了解如何编写代码或者您可以使用第三方包( NAudio [ ^ ])来完成它。

How can I play an mp3 file on the internet without waiting for being completely downloaded?

解决方案

Have you ever heard of term streaming? You can stream the audio from the internet, and then play the part of the media that has been streamed (downloaded), it depends on the network speed, and the CPU speed (how fast the CPU puts the downloaded content into the buffer so that your application can work on it).

There are multiple classes and namespaces that you can make use of. For example, the System.IO.Stream can be taken as example, you can download the bytes of stream, and then convert them into your particular file format to play them.

Give this another post[^] a try, to get an idea of how to write the code or you can use the third-party package (NAudio[^]) to complete it.


这篇关于在下载时播放mp3文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆