BP Forums
Opening a video automatically from a directory - Printable Version

+- BP Forums (https://bpforums.info)
+-- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=55)
+--- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=56)
+---- Forum: VB.NET (Visual Basic 2010/2008) (https://bpforums.info/forumdisplay.php?fid=8)
+----- Forum: Programming Help (https://bpforums.info/forumdisplay.php?fid=9)
+----- Thread: Opening a video automatically from a directory (/showthread.php?tid=476)



Opening a video automatically from a directory - K_Mccormic - 03-13-2012

Hi,

I have searched all over the web for some sort of simple code that would just open this video file. I have managed to create a media player but you have to choose the file yourself. Is there a simple way that would just load this single file when the form starts?


Re: Opening a video automatically from a directory - Vinwarez - 03-13-2012

Hello, K_Mccormic.

Yes, there is a very simple way to automatically load the specific file into the Windows Media Player made in VB10.

Steps:
1. Click on the Windows Media Player component on the design tab.
2. Go into the properties.
3. Find 'URL' field and type the path to the specific file. (An example is below)
4. Enjoy!


If you use Windows 7, you can copy and paste the text, below, into the URL field just to test how it works. Hehe!
Code:
C:\Users\Public\Videos\Sample Videos\Wildlife.wmv

Regards,
Vinwarez.


Re: Opening a video automatically from a directory - K_Mccormic - 03-14-2012

thanks for the quick reply. I got another question. when I tried to open the form with the media player, the program crashes and shows me the following error:

An error occurred creating the form. See Exception.InnerException for details. The error is: Could not load file or assembly 'WMPLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.#

I have no idea why it happened. it use to work <!-- s:? --><img src="{SMILIES_PATH}/icon_e_confused.gif" alt=":?" title="Confused" /><!-- s:? -->


Re: Opening a video automatically from a directory - Vinwarez - 03-14-2012

AtmaWeapon Wrote:Because VB .NET 2008 defaulted to AnyCPU and VS 2010 defaults to x86. Part of this is because of the troubles you're having, and I suspect part of it has to do with they didn't finish making Intellitrace work with x64 and it'd hurt their marketing to have a flagship feature not work out of the box.

There is no version of VS 2010 in which you can't change the platform, but it's harder in Express Edition. Here's how to do it:
  • Open solution explorer. (Ctrl+Alt+L by default.)
  • Right-click on your solution, not the project file. It's not visible by default in VB 2010 Express Edition, so if you can't see it:
    - Go to Tools>Options...
    - Click the "Projects and Solutions" item.
    - Check the "Always show Solution" box.
  • When you've right-clicked the solution, choose "Configuration Manager".

That window will list all of your projects and let you choose a platform. Make sure to change it for both release and debug builds.
Source: http://tinyurl.com/7gvr7h9