Ejemplo n.º 1
0
        /// <summary>
        /// Generic handler for Player error events.
        /// </summary>
        /// <remarks>
        /// Information returned in the event arguments is limited to the media object
        /// that was the source of the error. Further information can be obtained from
        /// IWMPMedia2.Error. Use IWMErrorItem.Description with caution, because messages
        /// may be more relevant to the Windows Media Player than to your application.
        /// </remarks>
        private void Player_MediaError(object sender, _WMPOCXEvents_MediaErrorEvent e)
        {
            IWMPMedia2    errSource = e.pMediaObject as IWMPMedia2;
            IWMPErrorItem errorItem = errSource.Error;
            String        errorDesc = errorItem.errorDescription;
            String        errorStr  = "Error " + errorItem.errorCode.ToString("X") + " in " + errSource.sourceURL + "\n" + errorDesc;

            MessageBox.Show(errorStr, "Player Error");
        }
Ejemplo n.º 2
0
        private void player_MediaError(object pMediaObject)
        {
            IWMPErrorItem error = ((IWMPMedia2)pMediaObject).Error;

            Console.Out.WriteLine($"Media Error {error.errorCode}: {error.errorDescription}");

            Marshal.ReleaseComObject(error);
            Marshal.ReleaseComObject(pMediaObject);
            Environment.Exit(Program.CODE_MEDIA_ERROR);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// event handler to display any errors encountered by the player
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Player_MediaError(object sender, AxWMPLib._WMPOCXEvents_MediaErrorEvent e)
 {
     //if media error is called, check and notify user if file is missing or corrupt
     try {
         IWMPMedia2    errSource = e.pMediaObject as IWMPMedia2;
         IWMPErrorItem errorItem = errSource.Error;
         MessageBox.Show("Error " + errorItem.errorCode.ToString("X") + " in " + errSource.sourceURL);
     } catch (InvalidCastException ex) {
         MessageBox.Show("Error received:" + ex.Message);
     }
 }
 private void preview_process_WMP_MediaError(object sender, AxWMPLib._WMPOCXEvents_MediaErrorEvent e)
 {
     try
     {
         IWMPMedia2    errSrc  = e.pMediaObject as IWMPMedia2;
         IWMPErrorItem errItem = errSrc.Error;
         MessageBox.Show("Error " + errItem.errorCode.ToString("X")
                         + " in " + errSrc.sourceURL);
     }
     catch (InvalidCastException)
     {
     }
 }
Ejemplo n.º 5
0
 private void Player_MediaError(object sender, _WMPOCXEvents_MediaErrorEvent e)
 {
     try
     {
         IWMPMedia2    errSource = e.pMediaObject as IWMPMedia2;
         IWMPErrorItem errorItem = errSource.Error;
         MessageBox.Show("Error " + errorItem.errorCode.ToString("X")
                         + " in " + errSource.sourceURL);
     }
     catch (InvalidCastException)
     {
         MessageBox.Show("Error.");
     }
 }
Ejemplo n.º 6
0
 private void mediaPlayer_MediaError(object sender, AxWMPLib._WMPOCXEvents_MediaErrorEvent e)
 {
     try
     // If the Player encounters a corrupt or missing file,
     // show the hexadecimal error code and URL.
     {
         IWMPMedia2    errSource = e.pMediaObject as IWMPMedia2;
         IWMPErrorItem errorItem = errSource.Error;
         MessageBox.Show(errorItem.errorDescription + " - " + errSource.sourceURL);
     }
     catch (InvalidCastException)
     // In case pMediaObject is not an IWMPMedia item.
     {
         MessageBox.Show("Error.");
     }
 }
Ejemplo n.º 7
0
        void WMP_OnError(object sender, EventArgs e)
        {
            IWMPErrorItem error = wmpCtrl.Error.get_Item(0);

            // error codes see http://msdn.microsoft.com/en-us/library/cc704587(PROT.10).aspx
            Log.Instance.Warn("WMPVideoPlayer Error '{0}': {1}", error.errorCode, error.errorDescription);
            MediaPortal.Dialogs.GUIDialogOK dlg_error = (MediaPortal.Dialogs.GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
            if (dlg_error != null)
            {
                dlg_error.Reset();
                dlg_error.SetHeading(PluginConfiguration.Instance.BasicHomeScreenName);
                dlg_error.SetLine(1, Translation.Instance.Error);
                dlg_error.SetLine(2, error.errorDescription);
                dlg_error.DoModal(GUIWindowManager.ActiveWindow);
            }
            PlaybackEnded();
        }
Ejemplo n.º 8
0
 void axWindowsMediaPlayer1_MediaError(object sender, AxWMPLib._WMPOCXEvents_MediaErrorEvent e)
 {
     try
     // If the Player encounters a corrupt or missing file,
     // show the hexadecimal error code and URL.
     {
         IWMPMedia2    errSource = e.pMediaObject as IWMPMedia2;
         IWMPErrorItem errorItem = errSource.Error;
         MessageBox.Show("Error " + errorItem.errorCode.ToString("X", CultureInfo.CurrentCulture)
                         + " in " + errSource.sourceURL);
     }
     catch (InvalidCastException)
     // In case pMediaObject is not an IWMPMedia item.
     {
         MessageBox.Show("Error.");
     }
 }
Ejemplo n.º 9
0
 private void OnNotificationSoundError(IWMPErrorItem error)
 {
     OnNotificationSoundError(error.errorCode == -1072885353 ? "Invalid media file." : error.errorDescription);
     Marshal.ReleaseComObject(error);
 }