Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
  Friend WithEvents AMC As AxAXISMEDIACONTROLLib.AxAxisMediaControl
  Friend WithEvents Button_PlayLive As System.Windows.Forms.Button
  Friend WithEvents Button_Stop As System.Windows.Forms.Button
  Friend WithEvents Text_UserName As System.Windows.Forms.TextBox
  Friend WithEvents Text_Password As System.Windows.Forms.TextBox
  Friend WithEvents Label1 As System.Windows.Forms.Label
  Friend WithEvents Label2 As System.Windows.Forms.Label
  <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
    Me.AMC = New AxAXISMEDIACONTROLLib.AxAxisMediaControl()
    Me.Button_PlayLive = New System.Windows.Forms.Button()
    Me.Button_Stop = New System.Windows.Forms.Button()
    Me.Text_UserName = New System.Windows.Forms.TextBox()
    Me.Text_Password = New System.Windows.Forms.TextBox()
    Me.Label1 = New System.Windows.Forms.Label()
    Me.Label2 = New System.Windows.Forms.Label()
    CType(Me.AMC, System.ComponentModel.ISupportInitialize).BeginInit()
    Me.SuspendLayout()
    '
    'AMC
    '
    Me.AMC.Enabled = True
    Me.AMC.Location = New System.Drawing.Point(8, 8)
    Me.AMC.Name = "AMC"
    Me.AMC.OcxState = CType(resources.GetObject("AMC.OcxState"), System.Windows.Forms.AxHost.State)
    Me.AMC.Size = New System.Drawing.Size(448, 336)
    Me.AMC.TabIndex = 0
    '
    'Button_PlayLive
    '
    Me.Button_PlayLive.Location = New System.Drawing.Point(16, 352)
    Me.Button_PlayLive.Name = "Button_PlayLive"
    Me.Button_PlayLive.TabIndex = 1
    Me.Button_PlayLive.Text = "Play Live"
    '
    'Button_Stop
    '
    Me.Button_Stop.Location = New System.Drawing.Point(16, 376)
    Me.Button_Stop.Name = "Button_Stop"
    Me.Button_Stop.TabIndex = 2
    Me.Button_Stop.Text = "Stop Play"
    '
    'Text_UserName
    '
    Me.Text_UserName.Location = New System.Drawing.Point(296, 352)
    Me.Text_UserName.Name = "Text_UserName"
    Me.Text_UserName.Size = New System.Drawing.Size(160, 20)
    Me.Text_UserName.TabIndex = 3
    Me.Text_UserName.Text = "root"
    '
    'Text_Password
    '
    Me.Text_Password.Location = New System.Drawing.Point(296, 376)
    Me.Text_Password.Name = "Text_Password"
    Me.Text_Password.PasswordChar = Microsoft.VisualBasic.ChrW(42)
    Me.Text_Password.Size = New System.Drawing.Size(160, 20)
    Me.Text_Password.TabIndex = 4
    Me.Text_Password.Text = "adp"
    '
    'Label1
    '
    Me.Label1.Location = New System.Drawing.Point(232, 352)
    Me.Label1.Name = "Label1"
    Me.Label1.Size = New System.Drawing.Size(64, 24)
    Me.Label1.TabIndex = 5
    Me.Label1.Text = "User Name:"
    Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
    '
    'Label2
    '
    Me.Label2.Location = New System.Drawing.Point(232, 376)
    Me.Label2.Name = "Label2"
    Me.Label2.Size = New System.Drawing.Size(64, 24)
    Me.Label2.TabIndex = 6
    Me.Label2.Text = "Password:"
    Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
    '
    'Form1
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(464, 421)
    Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label2, Me.Label1, Me.Text_Password, Me.Text_UserName, Me.Button_Stop, Me.Button_PlayLive, Me.AMC})
    Me.Name = "Form1"
    Me.Text = "Protected Server"
    CType(Me.AMC, System.ComponentModel.ISupportInitialize).EndInit()
    Me.ResumeLayout(False)

  End Sub

#End Region

  Private Sub Button_PlayLive_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_PlayLive.Click

    AMC.MediaPassword = Text_Password.Text
    AMC.MediaUsername = Text_UserName.Text

    ' Set the media URL and the media type
    AMC.MediaURL = "http://10.13.9.141/axis-cgi/mjpg/video.cgi"
    AMC.MediaType = "mjpeg-unicast"

    ' Start the download of the mpeg2 stream from the Axis camera/video server
    On Error GoTo ErrorHandler
    AMC.Play()
    Exit Sub

ErrorHandler:
    MsgBox("Error: " & Err.Description)

  End Sub

  Private Sub Button_Stop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Stop.Click

    AMC.Stop()

  End Sub
End Class
