-
April 23rd, 2013, 06:40 AM
#1
C# using windows forms how can I make media player to play MPEG2 files ?
Hello, I am trying to make a media player that can play MPEG2 files. I already made one using windows media player tool from .COM components of C# in .NET4.5 how can I make it support MPEG2 files for playing. This is my code :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Media_Player_Basic
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void openToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.Title = "Open";
open.Filter = "All Files|*.*";
try
{
if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
BasicWindowsMediaPlayer.URL = (open.FileName);
}
}
catch (ArgumentException ex) {
MessageBox.Show(ex.Message.ToString(),"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString(), "Massive Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
-
April 23rd, 2013, 11:25 AM
#2
Re: C# using windows forms how can I make media player to play MPEG2 files ?
What version of WindowsMediaPlayer are you using? Can you play the mpeg2 files in the media player application (outside of your code)?
-
April 23rd, 2013, 11:27 PM
#3
Re: C# using windows forms how can I make media player to play MPEG2 files ?
Originally Posted by Arjay
What version of WindowsMediaPlayer are you using? Can you play the mpeg2 files in the media player application (outside of your code)?
What I am seeing from COM components Windows Media Player its using the version 1.0
I am using visual studio 2012.
I cannot play it inside or outside of code.
-
April 24th, 2013, 01:39 PM
#4
Re: C# using windows forms how can I make media player to play MPEG2 files ?
Originally Posted by rumman0786
What I am seeing from COM components Windows Media Player its using the version 1.0
I am using visual studio 2012.
I cannot play it inside or outside of code.
Because you can't play the file outside the code, it tells me that the version you are using is either too old or you need to have the correct codec to play the file.
-
April 24th, 2013, 10:24 PM
#5
Re: C# using windows forms how can I make media player to play MPEG2 files ?
Originally Posted by Arjay
Because you can't play the file outside the code, it tells me that the version you are using is either too old or you need to have the correct codec to play the file.
I thats what I am trying to learn. How do I include a codec in WMP with code. Can you help me ?
-
April 25th, 2013, 12:18 PM
#6
Re: C# using windows forms how can I make media player to play MPEG2 files ?
Originally Posted by rumman0786
I thats what I am trying to learn. How do I include a codec in WMP with code. Can you help me ?
How do you know your problem is because of a missing codec? At any rate, if it is the problem, you will have to detect the presence of the codec you need, and install it if necessary in your app's setup program.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|