14 Replies - 1123 Views - Last Post: 17 December 2012 - 11:10 AM Rate Topic: -----

#1 CY5  Icon User is offline

  • D.I.C Regular

Reputation: 10
  • View blog
  • Posts: 314
  • Joined: 28-September 12

want to know how could i embed video in software.

Posted 15 December 2012 - 11:40 PM

When i deployed my project and gave it to my friend.The video inside the software could not be played.so want to know how could i embed video in software. Its visual basic project.
Is This A Good Question/Topic? 0
  • +

Replies To: want to know how could i embed video in software.

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8364
  • View blog
  • Posts: 31,076
  • Joined: 12-June 08

Re: want to know how could i embed video in software.

Posted 16 December 2012 - 02:17 AM

With only knowing zilch about who you set things up or called your video in code.. if it's added to the project click on it.. and set the compile property to 'embed'.
Was This Post Helpful? 1
  • +
  • -

#3 CY5  Icon User is offline

  • D.I.C Regular

Reputation: 10
  • View blog
  • Posts: 314
  • Joined: 28-September 12

Re: want to know how could i embed video in software.

Posted 16 December 2012 - 07:45 AM

I'm trying to create an application which plays a video on a form, everything works okay.
By the way i'm using axWindowsMediaPlayer component

The problem is, When I send this app to someone else, the video will not play.
Already expected this because of this line "axWindowsMediaPlayer1.URL = "C:\file-location-"

So I've put the video in my Resources and has set the property of Build=Embedded resources as you said but now i'm stuck even after doing this i am not able to play the video

If there are any suggestions please let me know ; :helpsmilie:/>

This post has been edited by CY5: 16 December 2012 - 07:48 AM

Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8364
  • View blog
  • Posts: 31,076
  • Joined: 12-June 08

Re: want to know how could i embed video in software.

Posted 16 December 2012 - 09:51 AM

Okay - well do a quick read up of how to use them.. you don't reference them like a file in a directory..

http://msdn.microsof...v=vs.80%29.aspx
http://msdn.microsof...v=vs.71%29.aspx
Was This Post Helpful? 0
  • +
  • -

#5 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: want to know how could i embed video in software.

Posted 16 December 2012 - 10:03 AM

View PostCY5, on 16 December 2012 - 08:45 AM, said:

So I've put the video in my Resources and has set the property of Build=Embedded resources as you said but now i'm stuck even after doing this i am not able to play the video

If there are any suggestions please let me know ; :helpsmilie:/>/>/>

axWindowsMediaPlayer will not play an embedded resource directly. If you open the Resources tab in the Solution Explorer, you'll see your video. Right click on it, and select Properties. Set "Copy to Output" to "Copy if Newer", and on running your software, the video will show up as a file in your current directory (\bin\Debug or \bin\Release), named the same as the filename you added to the resources.

So the axWindowsMediaPlayer.URL becomes "Resources\OriginalFileName.mp4"

Edit: oops! Didn't see modi's post until just now. Those are both good references.

This post has been edited by lar3ry: 16 December 2012 - 11:08 AM

Was This Post Helpful? 0
  • +
  • -

#6 CY5  Icon User is offline

  • D.I.C Regular

Reputation: 10
  • View blog
  • Posts: 314
  • Joined: 28-September 12

Re: want to know how could i embed video in software.

Posted 17 December 2012 - 05:00 AM

I tried this even to it was not working
Was This Post Helpful? 0
  • +
  • -

#7 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: want to know how could i embed video in software.

Posted 17 December 2012 - 07:03 AM

View PostCY5, on 17 December 2012 - 06:00 AM, said:

I tried this even to it was not working

I think I must have misread the article I was reading, and though it seemed to work when I tested it on a laptop, I haven't been able to make it work since.
Was This Post Helpful? 0
  • +
  • -

#8 CY5  Icon User is offline

  • D.I.C Regular

Reputation: 10
  • View blog
  • Posts: 314
  • Joined: 28-September 12

Re: want to know how could i embed video in software.

Posted 17 December 2012 - 07:55 AM

Hey i asked my friend about these he say "After putting video in resources you have to put the path, but the path should be relative not absolute. and says to check path convention online".
As i am mewbie to vb.net i need help on path convention so that i could solve out the problem.
Was This Post Helpful? 0
  • +
  • -

#9 lucky3  Icon User is offline

  • Friend lucky3 As IHelpable
  • member icon

Reputation: 231
  • View blog
  • Posts: 765
  • Joined: 19-October 11

Re: want to know how could i embed video in software.

Posted 17 December 2012 - 08:33 AM

If you want to play embedded video, you'll have to provide file path as string to URL property of AxWindowsMediaPlayer. You can't provide path from your resources, because resources are compiled into executable, and you can't direct player to read from inside exe location. So you'll have to save resource file somewhere, if you want to play it, and know where it's saved, to give the location to URL property of player. Meaning you need common writable location on every computer. One of such would usually be: My.Computer.FileSystem.SpecialDirectories.Temp

So if you have something like this when your application starts (let's say you have a form project):
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        IO.File.WriteAllBytes(My.Computer.FileSystem.SpecialDirectories.Temp & "\NameOfVideFile.wmv", My.Resources.NameOfVideFile)
        AxWindowsMediaPlayer1.URL = My.Computer.FileSystem.SpecialDirectories.Temp & "\NameOfVideFile.wmv"
    End Sub


it would probably do what you want. It will save video file from resources to Temp directory on each computer, and then use this path to play it.
Was This Post Helpful? 2
  • +
  • -

#10 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: want to know how could i embed video in software.

Posted 17 December 2012 - 09:57 AM

lucky3, that works great! I'll be using that in a small project soon.

I was trying to save the resource file using StreamWriter, but couldn't get it working.

CY5, if you just use the name of the file, without the path, it will save it in the Startup directory.
Was This Post Helpful? 1
  • +
  • -

#11 lucky3  Icon User is offline

  • Friend lucky3 As IHelpable
  • member icon

Reputation: 231
  • View blog
  • Posts: 765
  • Joined: 19-October 11

Re: want to know how could i embed video in software.

Posted 17 December 2012 - 10:12 AM

Great lar3ry! I'm interested in this small future project of yours ;) Keep in touch!
Was This Post Helpful? 1
  • +
  • -

#12 CY5  Icon User is offline

  • D.I.C Regular

Reputation: 10
  • View blog
  • Posts: 314
  • Joined: 28-September 12

Re: want to know how could i embed video in software.

Posted 17 December 2012 - 10:14 AM

Thanks you friends :)
Was This Post Helpful? 0
  • +
  • -

#13 CY5  Icon User is offline

  • D.I.C Regular

Reputation: 10
  • View blog
  • Posts: 314
  • Joined: 28-September 12

Re: want to know how could i embed video in software.

Posted 17 December 2012 - 10:53 AM

Quote

If you want to play embedded video, you'll have to provide file path as string to URL property of AxWindowsMediaPlayer. You can't provide path from your resources, because resources are compiled into executable, and you can't direct player to read from inside exe location. So you'll have to save resource file somewhere, if you want to play it, and know where it's saved, to give the location to URL property of player. Meaning you need common writable location on every computer

The way u r making is probably an exe , but in this case the user has to put the resource file in the location told by the developer ,, which no user wants to do.
Was This Post Helpful? 0
  • +
  • -

#14 lucky3  Icon User is offline

  • Friend lucky3 As IHelpable
  • member icon

Reputation: 231
  • View blog
  • Posts: 765
  • Joined: 19-October 11

Re: want to know how could i embed video in software.

Posted 17 December 2012 - 10:57 AM

CY5 I'm not really sure what you are saying here, but if you are concerned that user would need to manually save the file to some location specified by developer, you don't need to worry. The file in my code snippet is saved by the code to Temp directory of the Windows OS. Go ahead, and try it.
Was This Post Helpful? 1
  • +
  • -

#15 CY5  Icon User is offline

  • D.I.C Regular

Reputation: 10
  • View blog
  • Posts: 314
  • Joined: 28-September 12

Re: want to know how could i embed video in software.

Posted 17 December 2012 - 11:10 AM

Thanks Lucky3 it worked :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1