How to play a video file with Ax control

Answered How to play a video file with Ax control

  • Tuesday, February 26, 2008 11:28 AM
     
     

     

    I have an AVI video file. I am developing a windows form application and added an Ax realplayer control to it.How can I include the AVI video file in my application, so that the user can play it with the Ax realplayer control.

    Thanks.

All Replies

  • Wednesday, February 27, 2008 3:40 AM
     
     Answered

    Hi mishsad,

     

    You can add the AVI video file to Project Resources:

    Project menu -> Properties -> Resources tab -> Add Resource -> Add Exsiting file

     

    When you add an existing file to Resources in Project Properties window, a Resources folder containing the added file will created under project directory.

    Code Block

    Public Class Form1

     

        Dim ResourceFilePathPrefix As String

     

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

            ' Determine Resource folder path based on Debugging mode or Published mode

            If System.Diagnostics.Debugger.IsAttached() Then

                'Debugging

                ResourceFilePathPrefix = System.IO.Path.GetFullPath(Application.StartupPath & "\..\..\resources")

            Else

                'Published

                ResourceFilePathPrefix = Application.StartupPath & "\resources"

            End If

     

        End Sub

     

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

            ' Presume you have added clock.avi file to Resources

            ' Presume you use COM component: RealPlayer ActiveX Control Library

            AxRealAudio1.Source = ResourceFilePathPrefix & "\clock.avi"

            AxRealAudio1.AutoStart = True

        End Sub

     

    End Class

    Trackback: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2465529&SiteID=1

     

     

    Regards,

    Martin