Download tại đây
Cách sử dụng, download về upload lên host và chạy thôi.
TH1: Nếu muốn chạy file media (video,mp3,…) từ các host trung gian thì chỉ việc sửa đường dẫn file nhạc trong playlist.xml.
TH2: Nếu có thể upload nhạc, video trực tiếp lên host của mình thì vào playlist/playlists tạo thư mục bạn muốn, copy Video, nhạc vào thư mục đó
Sau khi tạo xong vào trang index.php
Sửa link http://www.mysite.com/player/getplaylist.php?playlist=tenthumuccuaban
<?php
include("OSMPlayer.php");$player = new OSMPlayer(array('playlist' => 'http://www.mysite.com/player/getplaylist.php?playlist=videos'
));?>
<html><head><title>Open Standard Media (OSM) Player: PHP Demo</title><script type="text/javascript" src="jquery-ui/js/jquery.js"></script><?php print $player->getHeader(); ?></head><body><h2>Open Standard Media (OSM) Player</h2><br/><?php print $player->getPlayer(); ?></body></html>
Lưu ý: khi bạn cập nhật, hoặc xóa video, audio thì vào playlist/cache xóa đi tenthumuccuaban.xml.
Nếu trong thư mục là audio, bạn có thể copy 1 tấm ảnh bất kỳ, để làm ảnh đại diện cho audio
Nếu là link từ Youtube, bạn cứ copy nguyên link http://www.youtube.com/watch?v=vbDg_pc7Hzw
paste vào playlist.xm trong thư mục gốc (TH1)
paste vào playlist/cache/tenthumuccuaban.xml
Từ từ hưởng thức và tìm hiểu thêm nha
Chúc vui!
KHOA NGUYỄN
DEMO: http://imgblog.khoapro.com/playlist-mp3-video-xml/osmplayer/
=======================================================================
Dynamic playlists using the OSM Player PHP library
Before you read this article, it is important that you first take a look at the prerequisitesThe OSM PHP library comes equiped with a powerful mechanism to create and manage playlists using simple directory structure on your server. This basically works by creating some special folders within theplaylist/playlists folder included in the OSM Player download. This tuturial will describe how this works, and how you can build your own playlists from local files on your server without the need for any Content Management System or backend database.
Creating your playlist
Creating a playlist for use within the stand alone OSM Player is surprisingly easy. The first thing you will need to do is create a new directory within the playlist/playlists folder, and give that directory the name of the playlist you would like to create. For example, if I wish to have a playlist called videos, then I will simply create a directory within the playlist/playlists folder called videos. When you are finished, you would then have the following directory... playlist/playlists/videos.Once you have created that directory, the next task is to create the tracks within that playlist. This is done by creating special directories that are labled as track{n}, where you would just replace the {n} with the number of the track you would like to add. For example, if your videos playlist will have 3 different tracks, then you will need to create 3 different folders named track1, track2, and track3. You can refer to thedefault playlist to determine how this directory structure should be layed out.
Adding your media
After you have your directories defined, the next task is to simply copy the media you would like for each track inside of it's respected folder. You can add one playable media ( such as mp3, mp4, flv, etc ), and one preview image per track folder. For example, if I wish to create a music playlist with the album art for each track, I would simply add my files in the following manner...- playlist
- playlists
- audio
- track1
- Jack Johnson - Better Together.mp3
- In between dreams.png
- track2
- Coldplay - Speed of Sound.mp3
- XandY.png
- track1
- audio
- playlists
Calling your playlist. Using the getplaylist.php script.
Now that you have your files in place, the next step is to call your playlist so that the playlist generator will create the XML file that will cache any future requests for that playlist. This is done through thegetplaylist.php file that is located within the root of the OSM Player folder. In order to generate the playlist you just created within the directories, you must now call this file from a web browser so that it will create a cache of your playlist within the playlist/cache folder. Assuming that your media player is located inside of a player directory within the public_html folder of your server, you can do this by simply making a call to http://www.mysite.com/player/getplaylist.php?playlist=videos. If your playlist is called something besides videos, then you can just use the syntax ofhttp://www.mysite.com/player/getplaylist.php?playlist={playlist_name}, where you would just replace {playlist_name} with the name of your playlist.Check the cache.
After you make the call to this script, there should now be a cached XML file for your playlist located in theplaylist/cache folder. The name of this XML file is {playlist_name}.xml, where you would just replace {playlist_name} with the name of your playlist. If you see this file, then all is well!Clearing the cache
One important thing to note about using this script is that any time that you add a new media track within your playlist, that you will need to "clear" the cached playlist. This is a rather simple task, where all you have to do is just delete the playlist XML file that was generated. The script will automatically generate a new playlist if no XML is found. This is essentially the same thing as "clearing the playlist cache", after adding a new media track.Adding the playlist to the HTML page
The last and final step is to show your new playlist within the player. This can be done using the playlistargument, and then pass in the path as shown below.<?php include("OSMPlayer.php"); $player = new OSMPlayer(array( 'playlist' => 'http://www.mysite.com/player/getplaylist.php?playlist=videos' )); ?> <html> <head> <title>Open Standard Media (OSM) Player: PHP Demo</title> <script type="text/javascript" src="jquery-ui/js/jquery.js"></script> <?php print $player->getHeader(); ?> </head> <body> <h2>Open Standard Media (OSM) Player</h2><br/> <?php print $player->getPlayer(); ?> </body> </html>
0 nhận xét:
Đăng nhận xét