Can you help me about inserting video in resources of visual basic and how to call it and play in my media player in a form..because i have media player in my project and my problem is how can i insert video and call it from resources...
i hope you can help me..Thanks a lot..!
I am going to assume that you mean adding a video to the embedded resources.
From the menu, goto Project->Properties. Then select the "Resources" tab. Next Select "Add Rersource"->"From Existing File". You can then select your video file. The file will be inserted with the File Name minus the extension as a binary array.
As far as I know, the media player control can only except a file reference to play. Therefore, you will need to write the binary array to a temporary file first.
Private TmpFiles As New List(Of String) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim fi As New IO.FileInfo(IO.Path.GetTempFileName()) Dim tmppath As String = IO.Path.GetTempFileName() ' The tmp file will have a ".tmp" extension ' The media player uses the extension to identify the proper codec to use to decode the file ' I used a wma video, so I will change the extension to that tmppath = tmppath.Replace(".tmp", ".wma") ' Create the file and write the resource array to it Dim tmp As IO.Stream = IO.File.Create(tmppath) ' Amanda is the name of my file tmp.Write(My.Resources.Amanda, 0, My.Resources.Amanda.Length) tmp.Close() 'Save a reference to tmp file so that you can delete it on the Form.Closing event TmpFiles.Add(tmppath) ' tell the player to play the file WMP1.currentMedia = WMP1.newMedia(tmppath) End Sub Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing For Each file As String In TmpFiles Try IO.File.Delete(file) Catch ex As Exception '' End Try Next End Sub
Thank you for this I am getting closer with your help. Regards Jakewebbe (Bill)
Hi TnTinMN Your code works fine but when I go to debug I get this message. 'Error 1 Unable to write to output file 'C:\Users\Bill\documents\visual studio 2010\Projects\resources test 2\resources test 2\obj\x86\Debug\resources test 2.exe': System Error &H8007000e& resources test 2'
My project name is resources test 2
I was wondering if this error is generated because of the total file sizes being around half a gig and or the amount of files I have added to the resources which would total around 35.
Any idea would be helpful, thanks.
Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...
Hello All ...
Iam Getting An Error With try to excecute the stored procedure .
I have Have Sql database , the stored procedure like so :
USE [MPRS] GO /****** Object: StoredProcedure [dbo].[Search_Licenses_By_Number] Script Date: 26-Nov-16 8:06:52 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE ...
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"
Here is the sample output that I ...