Setting Duration in API call doesn't enable "Set a duration?" setting


I am using the API to insert a Library item into a Playlist and including a ‘duration’ value. It appears to me that setting a duration value should cause the ‘useDuration’ value to be something other than 0. I base this on the following lines from the controller code:

        // If a duration is provided, then we want to use it
        if ($duration !== null)
            $widget->useDuration = 0;

However, when I run my code the useDuration value does not change. I know the ‘duration’ value is being passed because the correct ‘duration’ value is being returned/stored.

Am I missing something? Thanks!!

hmm ok I know what you mean.

So the call works fine and it does change the duration as specified in the call.

the code[quote=“PetCauseMedia, post:1, topic:8008”]
$widget->useDuration = 0;

Is a flag (0,1) for this checkbox ‘Set a duration?’

If it’s 0, then checkbox is not enabled - and when you check it, you will see correct duration
If it’s 1, then checkbox will be ticked by default, which perhaps makes sense, because we do set custom duration when we pass duration parameter in this API call.

To be honest it looks like a bug so -

Thank you for bringing this to our attention

1 Like