Updates
2/15/2011 – Yahoo! Media Player beta version is released
There is beta version available with YouTube/Yahoo! Movie pages support, please see
Yahoo! Media Player beta page or
this post for more information. Please note that some hacks mentioned here might not work with beta version.
How to use
Please visit the Yahoo! Media Player web site (
http://mediaplayer.yahoo.com/) for more information.
How to use a playlist
Please visit the Yahoo! Media Player public wiki (
http://yahoomediaplayer.wikia.com/wiki/How_to_link) for more information.
Note that you will not be able to test the functionality on your local computer because Yahoo! Media Player uses external service to retrieve and process XSPF files. It was done to avoid cross-domain access limitation for Flash objects and JavaScript code.
View example
How to change skin
If you want to dramatically change appearance of the player you would need to modify its skin. There are three images that player mostly uses however you will need to download just the skin image to change player’s appearance:
- Skin image, links: Yahoo.com, PonticStar.com
- Animated image used when player is minimized and playing a song, links: Yahoo.com, PonticStar.com
- Animated image used to locate audio link on the page, links: Yahoo.com, PonticStar.com
Once you have downloaded the skin image, use your favorite image editing program to customize it. In order to apply the skin you would have to use the code below.
Instructions: Update path to your image file. Append the following lines to CSS file or include them into HTML page somewhere in between
<head>
and
</head>
tags enclosing the block with tags
<style type="text/css">
and
</style>
.
#ymp-player .ymp-color-main { |
background-color : transparent !important ; |
background-image : url (/path/to/your/mediaplayer-skin.png) !important ; |
#ymp-body #ymp-btn-max span.ymp-animarrow { |
a.ymp-btn-page-target em.ymp-skin, |
a:hover.ymp-btn-page-target em.ymp-skin, |
a:active.ymp-btn-page-target em.ymp-skin { |
If you want to use reduce loading time and avoid using two additional images, use the following code instead:
#ymp-player .ymp-color-main { |
background-color : transparent !important ; |
background-image : url (/path/to/your/mediaplayer-skin.png) !important ; |
#ymp-body #ymp-btn-max span.ymp-animarrow { |
background-position : -119px -80px !important ; |
a.ymp-btn-page-target em.ymp-skin, |
a:hover.ymp-btn-page-target em.ymp-skin, |
a:active.ymp-btn-page-target em.ymp-skin { |
background-position : -624px -17px !important ; |
View example
How to adjust background color
Figure 1: Background color
Instructions: Update color values. Append the following lines to CSS file or include them into HTML page somewhere in between
<head>
and
</head>
tags enclosing the block with tags
<style type="text/css">
and
</style>
.
#ymp-player .ymp-color-main, |
#ymp-tray .ymp-color-tray { |
background-color : #2F437C !important ; |
View example
How to adjust text color
Instructions: Update color values. Append the following lines to CSS file or include them into HTML page somewhere in between
<head>
and
</head>
tags enclosing the block with tags
<style type="text/css">
and
</style>
.
#ymp-player .ymp-color-text-main { |
color : #000000 !important ; |
How to update block with relevant information
You may want to display your own message in the relevant information block instead of the default “learn more about this player” link. To do so you will need link to your media like this:
< a href = "music.mp3" >a song < span class = "relevant-info" >relevant info for this song</ span ></ a > |
Instructions: Append the following lines to CSS file or include them into HTML page somewhere in between
<head>
and
</head>
tags enclosing the block with tags
<style type="text/css">
and
</style>
.
Instructions: Insert the code below
right after the line that embeds the player into your page.
<script type= "text/javascript" > |
function apiReadyHandler(){ |
YAHOO.ympyui.util.Event.onDOMReady(UpdateRelevantInfo); |
YAHOO.MediaPlayer.onTrackStart.subscribe(UpdateRelevantInfo); |
function getElementsByClassName(className, tag, elm){ |
var testClass = new RegExp( "(^|\\s)" + className + "(\\s|$)" ); |
var elm = elm || document; |
var elements = (tag == "*" && elm.all) |
: elm.getElementsByTagName(tag); |
var length = elements.length; |
for ( var i=0; i<length; i++){ |
if (testClass.test(current.className)){ |
returnElements.push(current); |
function UpdateRelevantInfo() { |
var meta = YAHOO.MediaPlayer.getMetaData(); |
var a = (el.getElementsByClassName) |
? el.getElementsByClassName( "relevant-info" ) |
: getElementsByClassName( "relevant-info" , null , el); |
if (a.length > 0){ info = a[0].innerHTML; } |
document.getElementById( 'ymp-relevance' ).innerHTML = ' |
<div id= "ymp-relevant-info" > ' + info + ' </div> |
YAHOO.MediaPlayer.onAPIReady.subscribe(apiReadyHandler); |
View example
How to remove block with relevant information
Figure 2: Relevant information block is removed
Player displays “Learn more about this player” link along with lyrics or related videos. If you are trying to minimize size of the player, use the code below.
Instructions: Append the following lines to CSS file or include them into HTML page somewhere in between
<head>
and
</head>
tags enclosing the block with tags
<style type="text/css">
and
</style>
.
#ymp-relevance { display : none !important ; } |
.ymp-player-max #ymp-body { width : 570px !important ; } |
.ymp-player-max #ymp-body #ymp-body-strip { width : 557px !important ; } |
.ymp-player-max #ymp-body #ymp-body-base { width : 560px !important ; } |
View example
How to hide various buttons
Instructions: Append the following lines to CSS file or include them into HTML page somewhere in between
<head>
and
</head>
tags enclosing the block with tags
<style type="text/css">
and
</style>
.
#ymp-btn-close { display : none !important ; } |
#ymp-btn-pop { display : none !important ; } |
View example
How to change playlist colors
Figure 3: Playlist colors
Instructions: Update color values. Append the following lines to CSS file or include them into HTML page somewhere in between
<head>
and
</head>
tags enclosing the block with tags
<style type="text/css">
and
</style>
.
#ymp-tray .ymp-tray-track { |
color : #FFCE0C !important ; |
#ymp-tray .ymp-tray-track:hover { |
color : #FFFFFF !important ; |
background-color : transparent !important ; |
#ymp-tray .ymp-tray-track.playing, |
#ymp-tray .ymp-tray-track.playing:hover { |
color : #FFFFFF !important ; |
background-color : #777777 !important ; |
How to display album art
Figure 4: Album art
You can set the image which is displayed in the player during a song. To do this, put an
img
element within the playable link.
For example:
< a href = "example.mp3" >< img src = "example.png" alt = "" />my song</ a > |
The dimensions of the image should be square, not rectangular. If you don’t want the image to show up directly in the main web page, add
style="display:none"
to your
img
tag:
< a href = "example.mp3" >< img src = "example.png" alt = "" style = "display:none" />my song</ a > |
Source:
http://yahoomediaplayer.wikia.com/wiki/How_to_link#Album_Art
View example
How to change default album art image
Insert the code below just
before the line that embeds the player into your page.
<!-- Yahoo! Media Player configuration --> |
<script type= "text/javascript" > |
Source:
http://mediaplayer.yahoo.com/api/#param_defaultalbumart
How to hide album art
Figure 5: Hidden album art
#ymp-meta-image { display : none !important ; } |
#ymp-body #ymp-meta- bottom { |
View example
How to change meta (album title/web site URL) information
Instructions: Insert the code below
right after the line that embeds the player into your page.
<script type= "text/javascript" > |
function apiReadyHandler(){ |
YAHOO.ympyui.util.Event.onDOMReady(UpdateAlbumTitle); |
YAHOO.MediaPlayer.onTrackStart.subscribe(UpdateAlbumTitle); |
function getElementsByClassName(className, tag, elm){ |
var testClass = new RegExp( "(^|\\s)" + className + "(\\s|$)" ); |
var elm = elm || document; |
var elements = (tag == "*" && elm.all) |
: elm.getElementsByTagName(tag); |
var length = elements.length; |
for ( var i=0; i<length; i++){ |
if (testClass.test(current.className)){ |
returnElements.push(current); |
function UpdateAlbumTitle() { |
var meta_bottom = document.getElementById( 'ymp-meta-bottom' ); |
var el = getElementsByClassName( 'ymp-meta-box' , 'div' , meta_bottom); |
el[0].innerHTML = 'Visit <a href="http://www.lakeoftears.net" target="_blank" class="ymp-color-text-main">www.lakeoftears.net</a> for more info' ; |
YAHOO.MediaPlayer.onAPIReady.subscribe(apiReadyHandler); |
View example
How to hide meta (album title/web site URL) information
Instructions: Append the following lines to CSS file or include them into HTML page somewhere in between
<head>
and
</head>
tags enclosing the block with tags
<style type="text/css">
and
</style>
.
#ymp-meta-album-title { display : none !important ; } |
View example
How to hide the player
Sometimes you may want to display only small play button next to MP3 links. To hide the player use the code below.
Instructions: Append the following lines to CSS file or include them into HTML page somewhere in between
<head>
and
</head>
tags enclosing the block with tags
<style type="text/css">
and
</style>
.
There is another way to do it using parameter
displaystate
which is described at
http://mediaplayer.yahoo.com/api/#param_displaystate
View example
How to hide MP3 links
Instructions: Append the following lines to CSS file or include them into HTML page somewhere in between
<head>
and
</head>
tags enclosing the block with tags
<style type="text/css">
and
</style>
.
How to hide link play/pause buttons
Instructions: Append the following lines to CSS file or include them into HTML page somewhere in between
<head>
and
</head>
tags enclosing the block with tags
<style type="text/css">
and
</style>
.
margin-left : -20px !important ; |
a.ymp-btn-page-play em.ymp-skin, |
a.ymp-btn-page-pause em.ymp-skin { |
display : none !important ; |
View example
How to start player in a new window
The code below tries to launch player in a new window automatically which allows user to navigate your site without interrupting the player. However my code for displaying pop-under window doesn’t work as expected for all browsers which results in pop-up window instead.
Instructions: Insert the code below right
after the line that embeds the player into your page.
<script type= "text/javascript" > |
var ymp_pop_num_tries = 0; |
var ymp_pop_max_num_tries = 20; |
var ymp = YAHOO.mediaplayer; |
if (ymp_pop_num_tries > ymp_pop_max_num_tries){ return ; } |
if (ymp.Controller && ymp.Controller.view){ |
var ymp_pop = window.open( "" , "ymediaplayer" ); |
if (ymp_pop){ ymp_pop.blur(); } |
ymp.Controller.view.popPlayer({}); |
setTimeout(ympPopPlayer, 1000); |
function apiReadyHandler(){ |
YAHOO.MediaPlayer.onAPIReady.subscribe(apiReadyHandler); |
View example
How to disable Yahoo! search links
Instructions: Insert the code below right
after the line that embeds the player into your page.
<script type= "text/javascript" > |
function apiReadyHandler(){ |
YAHOO.MediaPlayer.onMediaUpdate.subscribe(DisableYahooLinks); |
YAHOO.MediaPlayer.onTrackStart.subscribe(DisableYahooLinks); |
setTimeout(DisableYahooLinks, 2000); |
function DisableYahooLinks(){ |
DisableLink(document.getElementById( 'ymp-meta-track-title' )); |
DisableLink(document.getElementById( 'ymp-meta-artist-title' )); |
DisableLink(document.getElementById( 'ymp-meta-image' )); |
DisableLink(document.getElementById( 'ymp-meta-album-title' )); |
function DisableLink(el){ |
el.href = 'javascript:void(0)' ; |
el.onclick = function (){ return false ; }; |
YAHOO.MediaPlayer.onAPIReady.subscribe(apiReadyHandler); |
View example
How to change default settings
See
http://mediaplayer.yahoo.com/api for more information.
ADS HERE
0 Comment:
Post a Comment