L
Lloyd Sheen
I am posting this to answer two question that I had posted earlier. I do
this since I think it is good practice for those who ask to confirm if
others suggestions fix their problem or if the poster fixed the problem
thereselves.
First is a problem with creating a "progress" type animation during the
playing of media files.
To accomplish this I did the following:
Create the element (I used a <td>) as follows:
<td id="DurationTDPos" style=" text-align:center;
background-image: url(Images/Progress.png);
background-position-x: -325px;
background-repeat: repeat-y ">
The png file is 325px wide to match the length of the td. It is originally
positioned -325px to make it non-visible using the background-position-x
attribute. As the media plays you calculate the % of the media played and
move the background image accordingly.
if (WMP.controls.currentPosition > 0)
{
currentPercent = (WMP.controls.currentPosition /
curItem.duration) * 100;
one = 325 - Math.floor(325 * (currentPercent/100));
two = '-' + one;
three = two + 'px';
currentPXString = three;
DurationTR.style.backgroundPositionX =currentPXString ;
}
The second problem was that when I was using a repeater I used the
ItemCreated rather than the ItemDataBound. What happened was the first time
it executed all looked fine on the page. A subsequent execution caused the
page to skip the page_load event and the button_click event such that the
data was not bound on the second execution and the ItemCreated was called
first with no e.Item.DataItem.
Changing the event fixed this problem.
Thanks
Lloyd Sheen
this since I think it is good practice for those who ask to confirm if
others suggestions fix their problem or if the poster fixed the problem
thereselves.
First is a problem with creating a "progress" type animation during the
playing of media files.
To accomplish this I did the following:
Create the element (I used a <td>) as follows:
<td id="DurationTDPos" style=" text-align:center;
background-image: url(Images/Progress.png);
background-position-x: -325px;
background-repeat: repeat-y ">
The png file is 325px wide to match the length of the td. It is originally
positioned -325px to make it non-visible using the background-position-x
attribute. As the media plays you calculate the % of the media played and
move the background image accordingly.
if (WMP.controls.currentPosition > 0)
{
currentPercent = (WMP.controls.currentPosition /
curItem.duration) * 100;
one = 325 - Math.floor(325 * (currentPercent/100));
two = '-' + one;
three = two + 'px';
currentPXString = three;
DurationTR.style.backgroundPositionX =currentPXString ;
}
The second problem was that when I was using a repeater I used the
ItemCreated rather than the ItemDataBound. What happened was the first time
it executed all looked fine on the page. A subsequent execution caused the
page to skip the page_load event and the button_click event such that the
data was not bound on the second execution and the ItemCreated was called
first with no e.Item.DataItem.
Changing the event fixed this problem.
Thanks
Lloyd Sheen