| |||||||
| General Development (no feature request here!) You were able to fix an issue, or improved a feature? Post it here. |
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Retired Team Member Join Date: Sep 2004 Location: Canada
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
| I have a timer elapsed event calling Player.g_Player.Play but it doesn't seem to fully work. I've verified that the player works just calling Play from a button but when this is called from a TimerElasped event it doesn't work. It seems to stall. Here is the output from the log: 11/09/2004 1:01:35 PM Player.Play(http://64.236.34.67:80/stream/8022) 11/09/2004 1:01:35 PM Loading external players plugins 11/09/2004 1:01:35 PM found plugin:MediaPortal.FoobarPlugin.FoobarPlugin in plugins\ExternalPlayers\FoobarExternalPlayer.dll 11/09/2004 1:01:35 PM player:Foobar2000. author: int_20h 11/09/2004 1:01:35 PM found plugin:MediaPortal.WinampPlayer.WinampPlugin in plugins\ExternalPlayers\WinampExternalPlayer.dll 11/09/2004 1:01:35 PM player:Winamp. author: int_20h Any help would is appreciated. |
| | |
| |
| | #2 (permalink) |
| Retired Team Member Join Date: Sep 2004 Location: Canada
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
| steping through the code it makes it to this line then I can't step past it. Line 63: m_player = new AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlay er(); in AudioPlayerWMP9.cs no exception happens though. |
| | |
| | #3 (permalink) |
| Portal Member Join Date: Aug 2004 Location: Airy Crater, Mars
Posts: 136
Thanks: 0
Thanked 0 Times in 0 Posts
| Might it be that the calls are made in a different context? I don't know how you handle the timer event and call the Play method. Is it from that timer event callback procedure, main program, UI dialog... Just guessing ![]()
__________________ Earth - The Final Frontier |
| | |
| | #4 (permalink) | |
| Retired Team Member Join Date: Sep 2004 Location: Canada
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
| Quote:
Code: public void OnTimer(Object sender, ElapsedEventArgs e)
{
if(sender == _AlarmClock)
{
GUISpinControl ctlHour = (GUISpinControl)GetControl((int)Controls.CONTROL_ALARMTIMEHOUR);
GUISpinControl ctlMinute = (GUISpinControl)GetControl((int)Controls.CONTROL_ALARMTIMEMINUTE);
DateTime dtNow = DateTime.Now;
if( dtNow.Hour == ctlHour.Value && dtNow.Minute == ctlMinute.Value)
{
_AlarmClock.Enabled = false;
Player.g_Player.Play(_SongPath);
GUIControl.SetControlLabel(GetID, (int)Controls.CONTROL_LABELSONGPATH,g_Player.Playing.ToString());
}
}
}
| |
| | |
| | #5 (permalink) |
| Portal Member Join Date: Aug 2004 Location: Airy Crater, Mars
Posts: 136
Thanks: 0
Thanked 0 Times in 0 Posts
| Aha. If hitting play from the control does work, than it might indeed be some kind of context problem. You might check out the Control.BeginInvoke Method (Delegate, Object[]) and EndInvoke methods which: The delegate is called asynchronously, and this method returns immediately. You can call this method from any thread, even the thread that owns the control's handle. If the control's handle does not exist yet, this method searches up the control's parent chain until it finds a control or form that does have a window handle. If no appropriate handle can be found, BeginInvoke will throw an exception. Exceptions within the delegate method are considered untrapped and will be sent to the application's untrapped exception handler. Note The BeginInvoke method calls the specified delegate back on a different thread pool thread. You should not block a thread pool thread for any length of time. Note There are four methods on a control that are safe to call from any thread: Invoke, BeginInvoke, EndInvoke, and CreateGraphics. For all other method calls, you should use one of the invoke methods to marshal the call to the control's thread. Altough I can't say for sure that it is INDEED a context problem, but if it is the BeginInvoke should solve it ![]()
__________________ Earth - The Final Frontier |
| | |
| | #6 (permalink) |
| Retired Team Member Join Date: Sep 2004 Location: Canada
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
| thanks for all your help.... it seems I was using a server timer from System.Timers.Timer namespace. I switched this over to a windows forms timer System.Windows.Forms.Timer and it all works great now!! On with the coding now ![]() |
| | |
| | #7 (permalink) | |
| Portal Member Join Date: Aug 2004 Location: Airy Crater, Mars
Posts: 136
Thanks: 0
Thanked 0 Times in 0 Posts
| Quote:
And BTW, for what will it be used??
__________________ Earth - The Final Frontier | |
| | |
| | #8 (permalink) | ||
| Retired Team Member Join Date: Sep 2004 Location: Canada
Posts: 215
Thanks: 0
Thanked 0 Times in 0 Posts
| Quote:
I am working on an alarm plugin. I thought it would be a good way to get my hands dirty with the project and learn the architecture. | ||
| | |
![]() |
| Bookmarks |
| Tags |
| calling, elapsed, event, gplayerplay, timer, working |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Auto Resume After Suspend Procedure | Dado | The old Bugreport Forum | 28 | 2006-04-23 17:59 |
| PVR Scheduler: cant make it work | ethanx | Codecs, External Players | 1 | 2006-03-19 23:42 |
| Hauppauge remote, not working. | Haplo | General Support | 17 | 2006-02-18 04:24 |
| Hauppauge 45 Buttons in My Video Fullscreen/back button bug | miljbee | The old Bugreport Forum | 4 | 2006-02-10 18:51 |
| Mediaportal crashing when power scheduler is activated | Adrian2M | General Support | 0 | 2005-12-30 16:07 |