Closed ghost closed 13 years ago
Figured it out:
I had hid the waveform image because I didn't want to show it, so the sizing didn't match up whatsoever. Little did I know that image was crucial. Make sure your waveform img is the same width as your timespan!
I've been able to get my player precisely to look exactly how I want it to work, but there are two issues with function:
1) I can't skip within the track. If I click the buffer it'll skip about halfway through the song, but I can't skip back to the beginning, or past that one point to the end (or anywhere in between). Generally speaking there is only one spot on the song that I can skip to.
A strange part about this is that I designed the player as a standalone player (100% width) and then migrated it into my layout. On the standalone it works fine re skipping, but when I moved it it scaled down to fit perfectly, but I'm getting this issue.
This has helped me isolate the problem:
When my stylesheet has this:
The skipping works fine
When my stylesheet has this:
Skipping stops working. And it doesn't matter if I hardcore 650px in there or keep it at 100% and it gets resized because it's inside another div. Once the entire sc-player div is resized it stops working properly.
Another clue is that if I click in the same physical place in my browser window it will always skip to the same place in the song. For example, if the player size is 100% of the browser and I click approx 25% into the song it'll skip to let's say 2:00 in the song (which is where my mouse is -- 8:00 song). But if the player size is decreased to 50% and I click approx 25% into the song it'll still skip to 2:00, which is not where my mouse is. It seems as if the div that controls this function is staying at 100%, but I can only click it if I'm inside the player, so if the player is 50% browser width and I click at 75% (outside of the player) it doesn't work.
It definitely has to do with this (inside sc-player.js):
event.pageX returns the x-position of the mouse from the left of the page. I think if I change that to the x-position of the mouse from the left of the sc-player element that might fix it. jQuery experts, how can I do this?
Sorry for the very long post, but I figure the more clues you have the more chances we have of figuring out the problem.
2) Related to this, if someone clicks and skips into the middle of the song there is no way to stop the song and get it to return to the beginning. Is there a button I can implement that would return the song to the beginning?
An added bonus would be if I could allow the user to skip to any part on the song with a line that displays over the buffer at the mouse displaying the time it would skip to. The default player on SC has this feature, it'd be great if I could add this as well.
Thanks, besides these two issues custom player works great.