This is my first question here...
I hope someone will be able to help me....
I have a form which has two panels.. one panel is for video player and other one is for ticker(label which moves from right to left)...
Problem is that this ticker moves fine when the video is playing.. but it pauses when the video is completed and new video is loaded... I am using windows media player.. And both video and the ticker is playing on a different thread...
Here's my piece of code..
private void Form_Load(object sender, EventArgs e)
{
System.Threading.ThreadStart starter = delegate
{
videoplayer();
};
new System.Threading.Thread(starter).Start();
System.Threading.ThreadStart SecondThread = delegate
{
tickerplayer();
};
new System.Threading.Thread(SecondThread).Start();
}
here's my code for ticker
private void tickerplayer()
{
tckr.Font = new Font("Arial", 10, FontStyle.Bold);
tckr.BackColor = Color.Transparent;
tckr.ForeColor = Color.Black;
tckr.Parent.BackColor = Color.Gray;
tckr.Text = "Denzel Washington";
tckr.TextAlign = ContentAlignment.MiddleCenter;
System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
t.Interval = 1;
t.Start();
t.Tick += (sender, EventArgs) =>
{
int z, hgt;
hgt = tckr.Location.Y;
z = tckr.Location.X;
if (z <= 0 - tckr.Width)
z = tckr.Parent.Width - 0;
else
z = tckr.Location.X - 3;
tckr.Location = new Point(z, hgt);
};
}
and this is for video
void wp2_PlayStateChange(object sender, _WMPOCXEvents_PlayStateChangeEvent e)
{
if (wp2.playState == WMPPlayState.wmppsPlaying)
{
if (play == true)
{
media = wp1.newMedia(@"D:\Parafait Home\Signage\ctvc_JOE.avi");
play = false;
wp1.currentMedia = media;
wp1.Ctlcontrols.stop();
}
}
if (wp2.playState == WMPPlayState.wmppsMediaEnded)
{
wp2.currentPlaylist.clear();
play = true;
wp1.Ctlcontrols.play();
}
return;
}
void wp1_PlayStateChange(object sender, _WMPOCXEvents_PlayStateChangeEvent e)
{
if (wp1.playState == WMPPlayState.wmppsPlaying)
{
if (play == true)
{
media = wp2.newMedia(@"D:\Parafait Home\Signage\ctvc_BAYER.AVI");
play = false;
wp2.currentMedia = media;
wp2.Ctlcontrols.stop();
}
}
if (wp1.playState == WMPPlayState.wmppsMediaEnded)
{
wp1.currentPlaylist.clear();
play = true;
wp2.Ctlcontrols.play();
}
return;
}
private void videoplayer()
{
media = wp1.newMedia(@"D:\Parafait Home\Signage\ctvc_JOE.avi");
play = true;
wp1.currentMedia = media;
}