microlinkhq / open

4 stars 2 forks source link

Microlink API: Support different resolutions #9

Closed Kikobeats closed 5 years ago

Kikobeats commented 6 years ago

Currently the API is returning one video detected:

{
  "video": {
    "url": "https://r3---sn-q4fl6ns7.googlevideo.com/videoplayback…",
    "width": 854,
    "height": 480,
    "type": "h264",
    "size": 4380005,
    "size_pretty": "4.38 MB",
    "duration": 141.44,
    "duration_pretty": "2m"
  }
}

The resolution of the video is very opinionated: It returns enough good quality for targeting mobile/desktop, but it never will return the best quality video detected.

A bit improvement will return a collection of resolutions detected:

{
  "video": [{
    "url": "https://r3---sn-q4fl6ns7.googlevideo.com/videoplayback…",
    "width": 854,
    "height": 480,
    "type": "h264",
    "size": 4380005,
    "size_pretty": "4.38 MB",
    "duration": 141.44,
    "duration_pretty": "2m"
  }, {
    "url": "https://r3---sn-q4fl6ns7.googlevideo.com/videoplayback…",
    "width": 1708,
    "height": 960,
    "type": "h264",
    "size": 4380005,
    "size_pretty": "4.38 MB",
    "duration": 141.44,
    "duration_pretty": "2m"
  }, {
    "url": "https://r3---sn-q4fl6ns7.googlevideo.com/videoplayback…",
    "width": 2562,
    "height": 1440,
    "type": "h264",
    "size": 4380005,
    "size_pretty": "4.38 MB",
    "duration": 141.44,
    "duration_pretty": "2m"
  }]
}

The collection are sorted from low to high quality. Then the user that is consuming the API can decide what resolution want to pick.

This will be applied to image or logo as well 🤔

Kikobeats commented 5 years ago

I'm going to close this right now, could be reopened in the future 🙂