473,668 Members | 2,821 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there a way to embed windows media player and control its parameters with PHP?

matheussousuke
249 New Member
I spent about 3 weeks on this. First I tried WMP embedded, didnt work (active x issue), then JW PLayer, didnt work too, then Flow Player, then Jw wmv player silver light (Yehaa, it worked, parcialy...)

It was 2 weeks to realize that flow player and jw player work with RTMP, but not with MMS video streams.

So, my question is: Is there a way to embed windows media player and control its parameters with PHP?

I mean, not active x controls, but pure php, along with java script, or something else that can be accepted by everybrowser.

I dont know a thing of ASP, tried and tried with silverlight player, and it simply wont play the mms stream, someone told me that I should change the port on the server, and on the script. I dont have access to that kind of stuff (server config), and also, I have an ASX playlist with more than 800 itens, most of them works fine.

Even if that's not windows media player, if anyone know at least a player that can play this stream mms://unitv.pucrs.br/UniTV on FireFox, or FF, or Safari, please, let me know.

ty very much :)


Ps: Note that the mms stream above works fine on Windows media player.
Feb 9 '11 #1
7 4448
HaLo2FrEeEk
404 Contributor
If it's an activex issue then it's your browser, because PHP is aserver-size language, all it does is print the code to the page. Here's the HTML that you need:

Expand|Select|Wrap|Line Numbers
  1. <OBJECT classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="[WIDTH]" height="[HEIGHT]">
  2. <PARAM NAME="URL" VALUE="[URL GOES HERE]">
  3. <PARAM NAME="volume" VALUE="[VOLUME]">
  4. <embed src="[URL GOES HERE]" width="[WIDTH]" height="[HEIGHT]" volume="[VOLUME]"></embed>
  5. </OBJECT>
PHP has nothing to do with it working or not, all it des it print the HTML to the page. I tested this code and it works.

Oh, and yes, you WILL need to replace the values that I've put inside [] brackets (including the brackets themselves).
Feb 10 '11 #2
matheussousuke
249 New Member
you're being of great help again, ty vm. :)
Feb 10 '11 #3
matheussousuke
249 New Member
This one is fully working for me. :D
By the way, is there a parameter that can show the playlist, so the user can choose wich item he will watch?
Feb 10 '11 #4
matheussousuke
249 New Member
I found a script, configured it acording to the guide, but now, only the player works, the playlist wont show up.

Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <script language="javascript1.2">
  3. function loadPlayItems() {
  4.         df=document.getElementById("playItem");
  5.         dp=document.getElementById("playlist");
  6.         WMP9=document.getElementById("MediaPlayer1");
  7.  
  8. WMP9.url="http://tv.mghospedagem.com/jwp-silverlight/play.asx";
  9.         WMP9.controls.play();
  10.  
  11. }
  12.  
  13. function showPlayItems() {
  14.         WMP9=document.getElementById("MediaPlayer1");
  15.         playlistItems=WMP9.currentPlaylist.count;
  16.         for (i=0; i<playlistItems; i++) {
  17.                 playitem=document.createElement("a");
  18.                 playnext=document.createElement("br");
  19.                 playitem.setAttribute("href","#");
  20.                 playitem.setAttribute("onclick","playItem("+i+")");
  21.                 playitem.innerText=WMP9.currentPlaylist.item(i).name;
  22.                 dp.appendChild(playitem);
  23.                 dp.appendChild(playnext);
  24.         }
  25.         playListLoaded=true;
  26.         WMP9.controls.stop();
  27.  
  28. }
  29.  
  30. function setPlayItem(index) {
  31.         WMP9=document.getElementById("MediaPlayer1");
  32.         playlistItems=WMP9.currentPlaylist.count;
  33.         if (playlistItems > 0) {
  34.  
  35. WMP9.controls.currentItem=WMP9.currentPlaylist.item(index);
  36.                 WMP9.controls.play();
  37.         }
  38. }
  39.  
  40. </script></head>
  41.  
  42. <body onLoad="loadPlayItems()">
  43. <object id="MediaPlayer1"
  44. classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6"
  45. type="application/x-oleobject" width="600" height="400">
  46. <param name="autostart" value="0">
  47.         <param name="showcontrols" value="0">
  48.         <param name="uimode" value="full">
  49.         <param name="stretchtofit" value="1">
  50.         <param name="enablecontextmenu" value="0">
  51. </object>
  52.  
  53. <div id="playlist" style="position: absolute; top: 10px; left:
  54. 640px; visibility: visible;">
  55. <h2>Playlist</h2></div>
  56.  
  57. <script language="javascript1.2" for="MediaPlayer1"
  58. event="playStateChange">
  59. WMP9=document.getElementById("MediaPlayer1");
  60. if (WMP9.playState==3 && ! playListLoaded) {
  61.         showPlayItems();
  62. }
  63.  
  64. </script>
  65.  
  66.  

You can see the page here http://tv.mghospedagem.com/wmp-plBYTES.html
Ps: only work for IE.

And here is where I got the code from https://groups.google.c om/group/microsoft.publi c.windowsmedia. player.web/browse_frm/thread/d134164e3d51496 3/0f180dd8ceaed3a 1?tvc=1&q=%22sh owPlayItems%28% 29%22+author:Ne il+author:Smith +author:[MVP+author:Digi tal+author:Medi a]&hl=en&pli=1
Feb 11 '11 #5
HaLo2FrEeEk
404 Contributor
Dude, this is Javascript, not PHP. This is a PHP forum, you'll need to ask one of the mods to move it to the Javascript forum. Please make sure you're posting in the proper forum next time.
Feb 11 '11 #6
matheussousuke
249 New Member
Omg, I really sorry, didnt notice that.

gomenasai >.<
Feb 11 '11 #7
matheussousuke
249 New Member
What if I open a new thread in javascript section and come here and put a link to it?
Feb 11 '11 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2065
by: Mickel Grönroos | last post by:
Hi! Anybody tried using Windows Media Player 9 via win32com? (And more precisely, combining that with a Tkinter application.) I found a few earlier threads on Windows Media Player and Python, but it seems nobody has really got it to work, e.g. the below does not work: wmp = win32com.client.Dispatch("MediaPlayer.MediaPlayer.1") wmp.FileName = "C:/Path/To/Some/Media/File.wav"
1
8911
by: Anise | last post by:
I have a question concerning embedding a windows media player into a web application in .net.. I download Windows Media Player 10 and its SDK On the .ascx page I placed a windows media player object from the toolbox and all the sites i read say when "Adding the Windows Media Player control from the Toolbox also adds references to two libraries created by Visual
1
7886
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 create a simple console application which will be able to find out what the values of a currently playing tack. I've downloaded the Windows Media player SDK which come with some IDL and
3
5182
by: UJ | last post by:
I have a .avi file that uses the Divx codec. If I load it with windows media player program it works fine. If I load it using my control in a program, it doesn't display. Over standard media files work fine so it's this particular file. Do I have to do anything when the file uses a non-included codec? How can I tell what Codec it's using? TIA - Jeff.
5
4569
by: Paul Fi | last post by:
I have this code which tries to obtain the number of items in the current playlist of windows media player: private void MainForm_Load(object sender, System.EventArgs e) { // get Window handle wnd = Win32.FindWindow("WMPlayerApp","Windows Media Player"); wnd = Win32.FindWindowEx(wnd, 0, "WMPAppHost", null); wnd = Win32.FindWindowEx(wnd, 0, "WMP Skin Host", null); wnd = Win32.FindWindowEx(wnd, 0, "CWmpControlCntr", null);
1
5536
by: sri2097 | last post by:
Basically, I want to check if a URL is playable or not (without actually playing it). i.e. given a URL I want to write an automation script to figure it out for me if it's playable or not. If you give a bad/invalid URL for windows media player to play a pop-up window shows us that it cannot be played. So I would want to catch that event.
19
19254
by: Tony | last post by:
I'm working on project that plays movies using Windows Media Player and I'm controlling everything with JavaScript. Per the client I only need to support IE 6 or greater which happens to make things a bit easier. What I need to do is create a playlist and play it using JavaScript. I keep on getting close but not close enough to play the dang files. Has anyone done this before and can shed some light on what worked for them?
0
1894
by: dongarbage | last post by:
Hi there, I've created a user control to put in a web page. I'd like to add a windows media player control to the user control that I've created. But, for some reason, the user control does not load when I add the windows media player control to it. Is the issue that I did not specify the HTML correctly? I have embedded a windows media player in a web page, and had to specify the CLSID for media player, but in this case, I'd like to...
0
2662
by: artsohc | last post by:
Hey Everyone, this is my first time posting so go easy on me. I am trying to hook up music-on-hold at the office I work at. I got all the music loaded and I got Windows Media Player working while the phones are on hold, but now I am trying to write a script that will allow Windows Media Player to run as a service so I can make it auto-start with out needing a user logged in on the computer. Also it would allow the music-on-hold to work if we...
1
2130
by: xhunter | last post by:
I am streaming some files on my site (progressive http streaming), I use php to authenticate logged in users with sessions and cookies, and then send the stream to be opened. All my Quicktime and Real players files are working absolutely fine in all browsers, but the problem is, when it comes to Windows Media Player and Firefox, it doesn't seem to work, what I think it is the problem, that windows media player doesn't seem to use the...
0
8381
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8583
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5681
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4205
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4380
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2791
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2023
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1786
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.