473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Pythoncom scripting Windows Media Player & visible


I'm trying to make Windows Media Player visible
and control it from Python. It seems when I call it
below, I get only the console version, and there's
no Visible method like with Internet Explorer.
I do catch events, but I need it visible.
Should it be put into a panel instead?
Should a different type dispatch be called
or a different method? it seems that there are
a console and a windows classes in the COM browser,
but I can't seem to access any useful windows classes.
I get "fullScreen" as False, but can't set it.
openPlayer(address) will launch a visible window,
but with no control of the the window after that.

Ideas?

from win32com.client import Dispatch,DispatchWithEvents

class WMPEvents:
def OnVisible(self,evt):
print "OnVisible changed:",evt
def OnError(self,evt=None):
print "OnError",evt
def OnMediaError(self,evt=None):
print "OnMediaError",evt
def OnDisconnect(self,evt):
print "OnDisconnect",evt
def OnStatusChange(self):
print "OnStatusChange"
def OnDisconnect(self,evt):
print "Disconnect",evt
def OnBuffering(self,evt):
print "OnBuffering changed:",evt
def OnOpenStateChange(self,evt=None):
print "OnOpenStateChange" ,evt

mp = DispatchWithEvents("WMPlayer.OCX.7",WMPEvents)
mp.Visible = True # Does nothing
tune = mp.newMedia("C:/WINDOWS/system32/oobe/images/title.wma")
mp.currentPlaylist.appendItem(tune)
mp.controls.playItem(tune)
mp.controls.play()
raw_input("Press enter to stop playing")
mp.controls.stop()

Aug 2 '05 #1
0 1509

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

56
by: alan b | last post by:
I copied it and tried to edit the movie.htm below in the <PARAM NAME=*** location of the file where the videoclip is on my hard drive. It is already recorded by Windows Media Player. My version...
1
by: Stephen Adam | last post by:
Hi there, Have spent a while trying to find out how to connect to Windows Media Player through COM. Unfortunately there doesnt seem to be much stuff about it on the web. What I need to do is...
2
by: masoha | last post by:
I'm trying to use the media player control in a form using visual Basic 6.0 In most files the control behavior is as expected but with some files the control send the following message: ...
2
by: Dan | last post by:
I have the following code: <html> <body> <OBJECT id="VIDEO" width="320" height="240" style="position:absolute; left:0;top:0;" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.