Hola,
En Internet encontré una clase que permite leer ficheros MP3 con C#,
pero necesitaria que esta clase me pueda indicar con un boolean (por
ejemplo) si un MP3 esta siendo leido por el Player o no, y no veo bién
como hacerlo.
Gracias por su ayuda.
Aqui esta el codigo :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace MyNamespace
{
public class Player
{
private string _command;
private bool isOpen;
[DllImport("winmm.dll")]
private static extern long mciSendString(string strCommand,
StringBuilder strReturn, int iReturnLength, IntPtr hwndCallback);
public Player()
{
}
public void Close()
{
_command = "close MediaFile";
mciSendString(_command, null, 0, IntPtr.Zero);
isOpen = false;
}
public void Open(string sFileName)
{
_command = "open \"" + sFileName + "\" type mpegvideo alias
MediaFile";
mciSendString(_command, null, 0, IntPtr.Zero);
isOpen = true;
}
public void Play(bool loop)
{
if (isOpen)
{
_command = "play MediaFile";
if (loop)
_command += " REPEAT";
mciSendString(_command, null, 0, IntPtr.Zero);
}
}
}
}
La forme des pyramides d'Egypte, nous apprend que dès la plus haute
antiquité,
les hommes avaient tendance à en faire de moins en moins.
- Anonyme -
Leer las respuestas