Support #6203
Using custom WProgressBar with WMediaPlayer
0%
Description
Hello,
I am using a custom WProgressBar to handle time updated event of WMediaPlayer but there is a client-server round trip:
###################################################
WMediaPlayer * audioPlayer = new WMediaPlayer();
audioPlayer->timeUpdated().connect(this, &MyWidget::audioPlaybackTimeUpdated);
...
...
void MyWidget::audioPlaybackTimeUpdated()
{
MyProgressBar->setValue( .... calculated value ... )
}
##############################################
Is there a way to make a javascript only connection between the WProgressBar and the WMediaPlayer objects ?
thanks a lot in advance for your help,
Updated by Momo LALMI about 5 years ago
Hello,
I am now using WMediaPlayer::setControlsWidget(...) to avoid client-server round trip
but I have detected a possible bug in file WMediaPlayer.C :
below: I think :
if (control_[i]) {
Should be replaced by :
if (display_[i]) {
because control_[0] is reserved for "videoPlay" button and is not related to "currentTime" WText
//########################################################
const char *displaySelectors[] =
{ "currentTime", "duration" };
for (unsigned i = CurrentTime; i < Duration; ++i) {
if (control_[i]) {
if (!first)
ss << ", ";
ss << const_cast<char *>(displaySelectors[i]) << ":\"#\"
<< display_[i]->id() << "\"\";
first = false;
}
}
//########################################################