Visual Basic Development Bookmark and Share   
 Home > Visual Basic IDE > change video size of windowsmediaplayer ActiveX
 

change video size of windowsmediaplayer ActiveX

Hi All,

I have a VB.NET application that uses the AXWindowMediaPlayer ActiveX to embed mpg videos to my application.

I have used the Play/pause/stop Ctlcontrols a lot but now i am stuck as i needed to change the video size of the playing video from 100 to 200%
hence my Questions:
- How can i by code change the video size of the video being played? by Video size i do not mean the control's size.. but the Video being played inside it. for example, i could want the videos to play at 200% and not at 100%.
- Is there a way to check the dimensions of the video being played so that i can by code change the video size if required as per the video. :-)

Hope somebody can help.. i am stuck at this and NEED a solution.

Thanks to all!

The Scorpion
thy scorpion  Tuesday, June 10, 2008 7:37 AM
HiScorpion,


Document: AxWindowsMediaPlayer.uiMode (VB and C#)
http://msdn.microsoft.com/en-us/library/bb262058(VS.90).aspx
The uiMode property gets or sets a value indicating which controls are shown in the user interface.

Value

Description

invisible

Windows Media Player is embedded without any visible user interface (controls, video or visualization window).

none

Windows Media Player is embedded without controls, and with only the video or visualization window displayed.

mini

Windows Media Player is embedded with the status window, play/pause, stop, mute, and volume controls shown in addition to the video or visualization window.

full

Default. Windows Media Player is embedded with the status window, seek bar, play/pause, stop, mute, next, previous, fast forward, rewind, and volume controls in addition to the video or visualization window.

custom

Windows Media Player is embedded with a custom user interface. Can only be used in C++ programs.


































Suggestion:

AxWindowsMediaPlayer1.stretchToFit=True
'e.g.Zoomto200%
AxWindowsMediaPlayer1.Width*=2
AxWindowsMediaPlayer1.Height*=2
'FullScreen
AxWindowsMediaPlayer1.fullScreen=True


AxWindowsMediaPlayer.stretchToFit
(VB and C#)
http://msdn.microsoft.com/en-us/library/bb262056(VS.90).aspx
The stretchToFit property gets or sets a value indicating whether video displayed by the Windows Media Player control automatically sizes to fit the video window, when the video window is larger than the dimensions of the video image.


Best regards,
Martin Xie

Martin Xie - MSFT  Friday, June 13, 2008 7:05 AM
HiScorpion,


Document: AxWindowsMediaPlayer.uiMode (VB and C#)
http://msdn.microsoft.com/en-us/library/bb262058(VS.90).aspx
The uiMode property gets or sets a value indicating which controls are shown in the user interface.

Value

Description

invisible

Windows Media Player is embedded without any visible user interface (controls, video or visualization window).

none

Windows Media Player is embedded without controls, and with only the video or visualization window displayed.

mini

Windows Media Player is embedded with the status window, play/pause, stop, mute, and volume controls shown in addition to the video or visualization window.

full

Default. Windows Media Player is embedded with the status window, seek bar, play/pause, stop, mute, next, previous, fast forward, rewind, and volume controls in addition to the video or visualization window.

custom

Windows Media Player is embedded with a custom user interface. Can only be used in C++ programs.


































Suggestion:

AxWindowsMediaPlayer1.stretchToFit=True
'e.g.Zoomto200%
AxWindowsMediaPlayer1.Width*=2
AxWindowsMediaPlayer1.Height*=2
'FullScreen
AxWindowsMediaPlayer1.fullScreen=True


AxWindowsMediaPlayer.stretchToFit
(VB and C#)
http://msdn.microsoft.com/en-us/library/bb262056(VS.90).aspx
The stretchToFit property gets or sets a value indicating whether video displayed by the Windows Media Player control automatically sizes to fit the video window, when the video window is larger than the dimensions of the video image.


Best regards,
Martin Xie

Martin Xie - MSFT  Friday, June 13, 2008 7:05 AM
Hi,
I'm making a user interface for a competition. And I have a form that read and writes to an excel file and then calls another form, which plays a pre-recorded video using embedded windows media player.
The problem is that when I try toset the media player to fullscreen, it gives me an error saying: COMException was unhandled (Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)))
wondering if someone could help
My code for the second form with the video is:
ImportsWMPLib
ImportsAxWMPLib
PublicClassstart2
PrivateSubstart2_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load
Me.TopMost=True
Ifwindows_counter=1Then
player()
windows_counter=0
Else
AxWindowsMediaPlayer1.uiMode="full"
AxWindowsMediaPlayer1.fullScreen=True
AxWindowsMediaPlayer1.Ctlcontrols.play()
EndIf
EndSub
PrivateSubAxWindowsMediaPlayer1_PlayStateChange(ByValsenderAsSystem.Object,ByValeAsAxWMPLib._WMPOCXEvents_PlayStateChangeEvent)HandlesAxWindowsMediaPlayer1.PlayStateChange
IfAxWindowsMediaPlayer1.playState=WMPLib.WMPPlayState.wmppsStoppedThen
Me.Hide()
Competition.ShowDialog()
EndIf
EndSub
PrivateSubplayer()
AxWindowsMediaPlayer1.URL=ResourceFilePathPrefix&"\count_down.wmv"
AxWindowsMediaPlayer1.uiMode="full"
AxWindowsMediaPlayer1.fullScreen=True
EndSub
EndClass
So to explain what I'm doing in this code, I'm trying to open a video. But to reduce the time it take for it to load, I want to just hide the form and then play the video again next time.

Thanks for you help in advance
P.S. the variable windows_counter is a global variable.
Hamid Sani  Friday, March 13, 2009 8:36 PM
hi martin ,I have same problem like scorpion but I want to change the size of video instead of changing the size of window media player.
Is there any property to do this please reply me as soon as possible.
ritu latiyan  Monday, July 13, 2009 9:58 AM
Hi ritu latiyan

i also have the same problem like yours. but for me, what suggested by martin is worked and solved my problem.

for example, you can put your windows media player inside the panel, and set the dock property to "Fill", so whenever you resize the panel, the media player always fill your panel.

and by setting:

AxWindowsMediaPlayer1.stretchToFit=
True

then the displayed video will streched to fit your panel size, whilst maintaining its aspect ratio.
next, you just set the panel size to the size you want, according to your need.

wish this will help you.
ivandreka  Tuesday, November 17, 2009 6:07 AM

You can use google to search for other answers

Custom Search

More Threads

• Unspecified Error in IDE when Access is opened
• Crystal missing from Clickonce Preq
• DataGrid - Deleting an item in Visual Basic 2003
• Using User controls
• clickonce install link opens manifest file
• Add text in middle of file
• Installation/Distribution over network
• XML Editor Not working in studio 2008
• How to move the mouse up, down, left, right and diagonally?
• Setup Wizard in VB 2005 Standard SP1