473,385 Members | 1,875 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,385 software developers and data experts.

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

matheussousuke
249 100+
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 4430
HaLo2FrEeEk
404 256MB
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 100+
you're being of great help again, ty vm. :)
Feb 10 '11 #3
matheussousuke
249 100+
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 100+
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.com/group/microsoft.public.windowsmedia.player.web/browse_frm/thread/d134164e3d514963/0f180dd8ceaed3a1?tvc=1&q=%22showPlayItems%28%29%22 +author:Neil+author:Smith+author:[MVP+author:Digital+author:Media]&hl=en&pli=1
Feb 11 '11 #5
HaLo2FrEeEk
404 256MB
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 100+
Omg, I really sorry, didnt notice that.

gomenasai >.<
Feb 11 '11 #7
matheussousuke
249 100+
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
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,...
1
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...
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...
3
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...
5
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...
1
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...
19
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...
0
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...
0
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...
1
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.