Jump to content
xisto Community
Sign in to follow this  
vicky99

How To Embed Ram File Produced By Http Header

Recommended Posts

Dear Friends
I want to stream music from my website. The file format is .rm. People say that one need a Helix Server or other media server to stream. I have found a solution to this problem as well. I read an article about streaming music. It tells that if the size of the media file is small and the byte rate of the media file is lower than that of the user internet connections byte rate, the file get streamed automatically from HTTP
server.
In theory, any file is "streamed" by a web server that is, sent back to the client in small pieces. What makes
media files special is that a media player can start playing the file even before it receives the full file. However, supposing the media player downloads one second of music, and plays it, and the data for the next second has not yet been downloaded, it will stop immediately. You will have to click Play again. However, if the bit rate of the media file is less than the bit rate of the connection, the player will always be able to download faster than play, and so, while there may be delays in playing the media, it won't stop.
I have uploaded couple of files on the server and they are working. But in my endeavor of making a contemporary online music website I am facing many problems which are as follows:-
I am using object and embed tag to play music in WebPages. I have created a RAM file which contains the links of the media files i.e. RM files. The RAM file is embedded to the web page e.g. <embed src=âhttp://forums.xisto.com/no_longer_exists/ â>. Up to this point everything is under control. Now I want to let my users choose multiple songs. To do that, I used check box to select more that one song. I used query strings to send the links or id of the selected songs and retrieved the urls on the page where the songs would be played. Here the problem arises. How can I add multiple url to embed tag.
I found out a solution but it did not work. My idea was to create a RAM file (Many of you guys may already know about it yet I would like to explain the phenomenon. One can create a RAM file which may contain more than one media file links. For example, aramfile.ram may contain both http://forums.xisto.com/no_longer_exists/ and http://forums.xisto.com/no_longer_exists/. If such a RAM file is embedded to a web page multiple songs can be played in a random manner) dynamically which would contain the list of links we received from query string. But with PHP, one cannot create a file on web server nor can open a file with write option. According to me it was the best possible solution but it is not feasible. I know that many professional personal employ this method. How they do it is mystery to me.
Then I began my search to find a way out. Fortunate I found out a way. Answer to my problem was HTTP HEADER. I would like to share what I understand about HTTP HEADER before I proceed.
Using headers server and browser communicate. Server sends headers before sending any other data.
Headers can contain many types of information and instructions that the server and browser use to help each other know what to do next.
Further PHP can be used to manipulate headers to get desired output. Using the following the codes one can create a ram file.
header("Cache-control: public");
header("Content-Type: audio/x-pn-realaudio ram;");
header("Content-Disposition: filename=a.ram");
echo $fres;
exit();
It did work. But in external player. I could not play the song inside the web page. So, friends I would be very grateful if some one helps me out âŚ..

Share this post


Link to post
Share on other sites

You explained your system well but not the actual problem. What errors you get when you try to open the RAM file with a player? Are you absolutely sure that the PHP script that outputs the RAM file produces correct code?If you have static RAM file that contains the SMIL code (that's SMIL right?) and a PHP file that outputs the exact same contents with HTTP headers, my opinion is that they should work in completely same way. Only problem that I can come up with is the media player which refuses to treat file with php extension as RAM, although the MIME type is correct. Check the player settings or try another one.

Share this post


Link to post
Share on other sites

Thank you very much..!Sir Hercco, Today I would try to explain the problem.I have created a system for playing music online. When a user clicks the link of the music file a pop up window appear and plays the song. I send the id of the song using query string and receive it and then get the link of the song from database. It works fine. Then in my last post, I mentioned that I want to provide my user with the facility to select multiple songs which would be played sequentially. For that, I used checkbox and send ids in the same manner I did previously. I then queried the database and received the links to the songs.Now, how to play these songs in a sequential order? This is the base problem. I have employed various methods but failed to achieve the goal.One of the methods was to use PHP header function. Using it I got very near to my goal. I could play the selected songs sequentially but in an external player (interface). I want to play the songs within the web page (in the pop up window mentioned above).If you want to know what I did please let me know .I would post my codes here. I hope to hear from you very soon.With Regards

Edited by vicky99 (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.