Click here to Skip to main content
13,897,185 members
Click here to Skip to main content

Stats

740.4K views
30.1K downloads
281 bookmarked
Posted 14 Sep 2010
Licenced CPOL

PVS.AVPlayer - MCI Audio and Video Library

, 7 Aug 2018
Windows Media Control Interface (MCI) library with many added features
PVS.AVPlayer
PVS.AVPlayer .NET 2.0
PVS.AVPlayer.XML
PVS.AVPlayer .NET 3.0
PVS.AVPlayer.XML
PVS.AVPlayer .NET 3.5
PVS.AVPlayer.XML
PVS.AVPlayer .NET 4.0
PVS.AVPlayer.XML
PVS.AVPlayer .NET 4.5
PVS.AVPlayer .NET 4.5.1
PVS.AVPlayer.XML
PVS.AVPlayer .NET 4.5.2
PVS.AVPlayer.XML
PVS.AVPlayer.XML
PVS.AVPlayer .NET 4.6
PVS.AVPlayer.XML
PVS.AVPlayer.dll
PVS.AVPlayer.XML
PVS.AVPlayer.dll
PVS.AVPlayer.XML
PVS.AVPlayer.dll
PVS.AVPlayer.XML
PVS.AVPlayer.dll
PVS.AVPlayer.XML
PVS.AVPlayer.dll
PVS.AVPlayer.XML
PVS.AVPlayer.dll
PVS.AVPlayer.XML
PVS.AVPlayer.dll
PVS.AVPlayer.XML
PVS.AVPlayer .NET 4.6.1
PVS.AVPlayer.dll
PVS.AVPlayer.XML
PVS.AVPlayer .NET 4.6.2
PVS.AVPlayer.dll
PVS.AVPlayer.XML
PVS.AVPlayer.dll
PVS.AVPlayer.XML
PVS.AVPlayer .NET 4.7
PVS.AVPlayer .NET 4.7.1
PVS.AVPlayer.dll
PVS.AVPlayer.XML
PVS.AVPlayer .NET 4.7.2
PVS.AVPlayer.dll
PVS.AVPlayer.XML
PVS.AVPlayer.dll
PVS.AVPlayer.XML
PVS.AVPlayer All Source Code
AVPlayerExample
AVPlayerExample
AVPlayerExample.csproj.user
bin
Debug
PVS.AVPlayer.XML
Release
Dialogs
Display Overlays
obj
Debug
Release
x86
Debug
Release
Properties
Resources
Crystal Italic1.ttf
WingDings3a.ttf
Voice Recorder
FolderView
FolderView
bin
Debug
PVS.AVPlayer.XML
Release
FolderView.csproj.user
obj
Release
x86
Debug
Release
Properties
Resources
Crystal Italic1.ttf
PVS.AVPlayer
AVPlayerExample.csproj.user
PVS.AVPlayer.dll
PVS.AVPlayer.XML
Custom Items
Native Methods
Bob.png
Crystal Italic1.ttf
Dial Green 2.png
Dial Green 4.png
Dial Green.png
Dial Red 2.png
Dial Red.png
media7.ico
media7a.ico
Media8.ico
Media8a.ico
VU Meter.png
WingDings3a.ttf
Sound Recorder
Various
About Dialog
PVS.AVPlayer.dll
PVS.AVPlayer.XML
Custom Items
FolderView.csproj.user
Debug
Bob.png
Crystal Italic1.ttf
media7a.ico
media7b.ico
Media8a.ico
Media8b.ico
Subtitles Overlay
Various
How To (C#)
PVSAVPlayerHowTo
bin
Debug
PVS.AVPlayer.dll
PVS.AVPlayer.XML
Release
obj
Debug
Release
Properties
How To (VB.NET)
PVSAVPlayerHowToVB
bin
Debug
PVS.AVPlayer.dll
PVS.AVPlayer.XML
Release
My Project
Application.myapp
obj
Debug
Release
PVSAVPlayerHowTo.vbproj.user
PVS.AVPlayer Examples
AVPlayerExample.ex_
FolderView.ex_
AVPlayerExample.exe
FolderView.exe
PVS.AVPlayer.dll
#region Usings

using System.Drawing;
using System.Windows.Forms;

#endregion

namespace PVSAVPlayerHowTo
{
    public partial class Overlay : Form
    {

        // This is a sample PVS.AVPlayer display overlay:
        // it shows a label with the text "Display Overlay" on top of movies.
        // As an example of overlay 'animation' the text is made 'flashing'.

        // The background color is 'close' to the text color to prevent
        // visible 'borders' around the letters of the text.

        // The text remains in the middle of the video image because
        // the label is 'anchored' on all sides of the form and the
        // text is centered (TextAlign MiddleCenter).

        // The display overlay (Form) also contains a label
        // that is used to display subtitles.


        // **** Class Fields **************************************************************************

        #region Class Fields

        private readonly Color  FOREGROUND_COLOR    = Color.Red; // = 255, 0, 0
        private readonly Color  BACKGROUND_COLOR    = Color.FromArgb(200, 0,0);
        private const int       TIMER_INTERVAL      = 600;

        private Timer           flashTimer;         // the timer used for flashing text
        private bool            flashOn;            // the state of the flashing text
        private bool            isDisposed;         // used with cleaning up

        #endregion


        #region Main

        // **** Main **********************************************************************************

        // the display overlay constructor
        public Overlay()
        {
            InitializeComponent();

            subtitlesLabel.Text = "";

            flashTimer          = new Timer();
            flashTimer.Interval = TIMER_INTERVAL;
            flashTimer.Tick     += FlashTimer_Tick;
        }

        // the animation (timer) is switched on/off when the form's visibility changes, the form's
        // visibility (among other) changes when the overlay is activated/deactivated by the player:
        private void Overlay_VisibleChanged(object sender, System.EventArgs e)
        {
            if (this.Visible)
            {
                flashOn = false;
                flashLabel.ForeColor = FOREGROUND_COLOR;
                flashTimer.Start();
            }
            else flashTimer.Stop();
        }

        // here the 'animation' (text flashing) is done
        private void FlashTimer_Tick(object sender, System.EventArgs e)
        {
            if (flashOn) flashLabel.ForeColor = FOREGROUND_COLOR;
            else flashLabel.ForeColor = BACKGROUND_COLOR;

            flashOn = !flashOn;
        }

        // clean up - this is moved here from the 'Overlay.Designer.cs' file and appended:
        protected override void Dispose(bool disposing)
        {
            if (!isDisposed)
            {
                isDisposed = true;
                if (disposing)
                {
                    if (flashTimer != null) flashTimer.Dispose();
                    // used by the designer - clean up:
                    if (components != null) components.Dispose();
                }
            }
            base.Dispose(disposing);
        }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Peter Vegter
United States United States
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web06 | 2.8.190306.1 | Last Updated 7 Aug 2018
Article Copyright 2010 by Peter Vegter
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid