|
Partial Public Class MainPage
Inherits UserControl
' Instantiate our derived MediaStreamSource class
Dim _mediaSource As MyDerivedMediaStreamSource
'<summary>
' Flag to indicate if our media has been opened or not
'</summary>
Dim mediaOpen As Boolean = False
Dim _filename As String = "Video_File_Full_Path_Here.avi"
'Dim aviObj As cAVIDefs
Public Sub New()
InitializeComponent()
End Sub
Private Sub OpenStream_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles OpenStream.Click
' initialize our media stream object
_mediaSource = New MyDerivedMediaStreamSource()
' check if we secceeded opening the AVI
If _mediaSource.startVideo(_filename) Then
' set flag to true - media has been opened
mediaOpen = True
' set the source of our media stream to the MediaElement
mediaPlayer.SetSource(_mediaSource)
End If
End Sub
Private Sub CloseStream_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles CloseStream.Click
If mediaOpen Then ' check if we still have the media open
mediaPlayer.Stop()
_mediaSource.closeStream()
_mediaSource = Nothing
mediaOpen = False
End If
End Sub
End Class
|
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.
I have been a Developer for many years. I have worked as Senior Developer in Kenya, Canada and Saudi Arabia. I enjoy coding and I am looking forward to more challenges with new Technologies
I am currently IT Manager at Norconsult Telematics, Saudi Arabia.