Cannot specify widget duration with API

Hi,everybody

I have a question about specifing widget duration with API

I’m using xibo-cms2.0.4 .

When I assigned images to playlist with API, I specified duration of image widget.
But this value in responce is not specified duration by me.
That is value of image widget. (now I’m setting it 20sec.)

img1

Am I forgetting somthing about that?

(Sorry for lack of English skill.)

The playlist/library/assign API call, takes an array of mediaIds, however it takes one duration and useDuration parameter that will be applied to all widgets assigned in this call.

That said, we seem to have a bug where the duration reverts to the Module default duration.

The $module->setDefaultWidgetOptions() will set the useDuration to 0 and duration to the default duration set on the module (Image module in this case).

While we do set the $widget->useDuration = 1 if it was provided in the call, we do not do that with the duration, hence why it’s not correctly set.

it should be just the case of editing the highlighted condition to say the following:

            if ($duration !== null || $this->getSanitizer()->getCheckbox('useDuration') == 1) {
                $widget->useDuration = 1;
                $widget->duration = $itemDuration;
            }

Alternatively you can edit the Image widget after it was assigned with PUT /playlist/widget/{widgetId} and set the duration there.

1 Like

Hi,Peter.
Thank you for comment.

I confirmed that each two solutions that you suggested was right.
It worked!

And I did one misunderstanding.
“duration” and “useDuration” are not array. So “[]” was unnecessary.

Thank you for quick and detailed answer.