Author Topic: API add media to playlist with 0 duration  (Read 356 times)

Offline Dapeng

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
API add media to playlist with 0 duration
« on: December 08, 2016, 05:55:34 AM »
I played some APIs, from upload File(image) to create media, then allocate it to a playlist.  Most are functional but I found the new item in playlist is 0 duration - that cause no showing in player.

I confirm the playlist Default image duration (HH:mm:ss): 00:00:07, see attached screenshot.  I also try to recreate the playlist (all in default value), and clear all media, even reboot server, but no success.

I doubt if it is a bug.  And is there a possible tweak in API, i.e,  there is an API can modified the item duration after added to playlist? So far I cannot find it can be done by API.

The API I used:
/api/rest/fileupload/init
/api/rest/fileupload/part/%s/0
/api/rest/playlists/%s/playlistItems/%s
 
First 2 for uploading image the creating the media, last is adding media to playlist.  In 2nd screenshot, you will find its duration is 0.


Offline nicu

  • Jr. Member
  • **
  • Posts: 48
  • Karma: 1
    • View Profile
Re: API add media to playlist with 0 duration
« Reply #1 on: December 08, 2016, 08:31:14 AM »
To upload file to Content Manager you should follow this 3 steps:
1. "fileupload/init" that return DTO
2. "fileupload/part/" + dto.getUuid() +"/0"
3. "fileupload/complete/" + dto.getUuid()

Offline Dapeng

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Re: API add media to playlist with 0 duration
« Reply #2 on: December 08, 2016, 06:20:55 PM »
Looks not because of file upload. I used POST to upload, base on document on upload POST: "Upload media data. Once all data is transfered, the server will automatically call 'complete' service.". After POST, the media image can display correctly. At this case, if I send complete request afterwards, it got "InvalidUploadId" error response.

I also try PUT, then send complete request, both return 204 - looks success, but the media image does not display.

Here 2 screenshots missed in last post:
https://www.dropbox.com/s/p3poumh7anm75gw/Screen%20Shot%202016-12-08%20at%209.38.18%20pm.png?dl=0
https://www.dropbox.com/s/7ktordue5q2a944/Screen%20Shot%202016-12-08%20at%209.38.25%20pm.png?dl=0

Offline nicu

  • Jr. Member
  • **
  • Posts: 48
  • Karma: 1
    • View Profile
Re: API add media to playlist with 0 duration
« Reply #3 on: December 09, 2016, 08:01:37 AM »
Did you try to add this image manually to the playlist?

Offline Dapeng

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
    • View Profile
Re: API add media to playlist with 0 duration
« Reply #4 on: December 11, 2016, 12:53:29 AM »
Yes, if I add same media file(uploaded by API) to playlist, it is default 7 seconds. In attached screenshot, the last one is manually added. Others are added by API.

I test on both content manager 10.2 and 10.5.5, same issue.

https://www.dropbox.com/s/g3ytipyh1kpjymi/Screen%20Shot%202016-12-10%20at%202.54.52%20pm.png?dl=0
« Last Edit: December 11, 2016, 01:18:00 AM by Dapeng »

Offline nicu

  • Jr. Member
  • **
  • Posts: 48
  • Karma: 1
    • View Profile
Re: API add media to playlist with 0 duration
« Reply #5 on: December 14, 2016, 08:32:18 AM »
Try to use PUT "playlists/%s/playlistItems/%s", playlistId, mediaIds that works for me.