Moderátor: Moderátoři Živě.cz
System.Windows.Media.MediaPlayer mp = new System.Windows.Media.MediaPlayer();
mp.Open(new Uri(@"D:\test.mp3"));
mp.Play();
Nogar píše:Zkusil jsem hodně možností jenže buď to hodí chybu a nebo nic nehraje.
Třeba napíšu:
Microsoft.DirectX.AudioVideoPlayback.Audio audio;
audio = Microsoft.DirectX.AudioVideoPlayback.Audio.FromFile(@"D:\music.mp3");
audio.Play();
using System;
using System.Windows.Forms;
namespace WindowsFormsApplicationTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
System.Windows.Media.MediaPlayer mp = new System.Windows.Media.MediaPlayer();
mp.Open(new Uri(@"D:\test.mp3"));
mp.Play();
}
}
}
public Form1()
{
InitializeComponent();
System.Windows.Media.MediaPlayer mp = new System.Windows.Media.MediaPlayer();
mp.MediaEnded += new EventHandler(mp_MediaEnded);
mp.Open(new Uri(@"D:\test.mp3"));
mp.Play();
}
void mp_MediaEnded(object sender, EventArgs e)
{
MessageBox.Show("Prehravani dojelo na konec.");
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using TheGame.Properties;
using Microsoft.DirectX.AudioVideoPlayback;
using Microsoft.DirectX.DirectSound;
using Microsoft.DirectX.DirectPlay;
using Microsoft.DirectX;
using System.Media;
using Microsoft.DirectX.DirectDraw;
namespace TheGame
{
public partial class Form1 : Form
{
Microsoft.DirectX.AudioVideoPlayback.Video video = new Microsoft.DirectX.AudioVideoPlayback.Video("video.avi");
public Form1()
{
//VIDEO//
video.Owner = this;
video.Play();
if (video.Ending == true)
{
video.Stop();
video.Size = new Size(0, 0);
video.Owner = null;
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using TheGame.Properties;
using Microsoft.DirectX.AudioVideoPlayback;
using Microsoft.DirectX.DirectSound;
using Microsoft.DirectX.DirectPlay;
using Microsoft.DirectX;
using System.Media;
using Microsoft.DirectX.DirectDraw;
namespace TheGame
{
public partial class Form1 : Form
{
Microsoft.DirectX.AudioVideoPlayback.Video video = new Microsoft.DirectX.AudioVideoPlayback.Video("Music\\AMD.avi");
public Form1()
{
//VIDEO//
video.Owner = this;
video.Play();
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
video.Ending += new EventHandler(video_Ending);
void video_Ending(object sender, EventArgs e)
{
video.Dispose();
video.Owner = null;
}
Uživatelé procházející toto fórum: Žádní registrovaní uživatelé a 0 návštevníků