API : Adding a local video widget

Hi,

I was testing the local video widgets manually from the CMS, and it worked. For example I write (http://192.168.0.21:5858/xibo2-LC.api.ch/public_html/user_2/grpplayer_1/medias/30sec.mp4) in the url field of the local video and when I schedule it, the player is displaying it.

Then I tried doing it with the oauth2 API using the create function here : (oauth2-xibo-cms/XiboLocalVideo.php at 8e6ddb4be070257233c225f8829b8117f9d978c3 · xibosignage/oauth2-xibo-cms · GitHub)

I tried giving it the url encoded, and non encoded but I always get this error :

Any ideas ?

I think I can understand what has happened there.

Presumably in your code you’re calling checkout on a layout (to make it a draft), then you’re adding a widget and try to publish it?
Then the publish layout fails, because the localVideo widget has empty uri.

Now, as for why is it empty.

Our oauth2 php library wasn’t updated after the changes to how the widget add call works.

It’s basically the same for all widgets, it just adds it there to the playlist and edit call is for changing the widget options.

so, if you currently call something like say:
$localVideo = (new \Xibo\OAuth2\Client\Entity\XiboLocalVideo($entityProvider))->create('http://192.168.0.21:5858/xibo2-LC.api.ch/public_html/user_2/grpplayer_1/medias/30sec.mp4', 10, 1, 'aspect', 0, 669, '');

Even though you do pass options here, it will not be saved, because add widget no longer takes parameters, so it will add localVideo widget to your layout, same way as if you’d add it via web ui ie without any options set.

You’d need to call edit with pretty much the same parameters ie
(new \Xibo\OAuth2\Client\Entity\XiboLocalVideo($entityProvider))->edit('http://192.168.0.21:5858/xibo2-LC.api.ch/public_html/user_2/grpplayer_1/medias/30sec.mp4', 10, 1, 'aspect', 0, $localVideo->widgetId, 'Inherit');

Then publish layout and it should be fine.

We will try to update the wrappers as soon as possible of course.

It worked! Thanks
Had another error but this time creating a widget with the url of an image on my disk, it tells me that the file is too small :


Could it be the same kind of error or is it a whole different topic ?