vimeovimeo-apivimeo-android

Vimeo API suddenly stopped returning progressive field in video response - Issue with Flutter Android app integration


I have integrated Vimeo video API into my Flutter Android app, and it was working fine until recently. I was calling the following Vimeo API endpoint:

GET https://api.vimeo.com/videos/{video_id}?fields=play,name,pictures

The response I used to get included a "progressive" field under the "play" field, as shown in the documentation: https://developer.vimeo.com/api/files/video-links

Here’s the expected sample response from the API:

{
  "play": {
    "progressive": [
      {
        "type": "video/mp4",
        "codec": "H264",
        "width": 480,
        "height": 360,
        "link": "https://player.vimeo.com/progressive_redirect/playback/.../video.mp4",
        "created_time": "2018-08-27T14:58:07+00:00",
        "size": 1067683,
        "fps": 29.97
      },
      {
        "type": "video/mp4",
        "codec": "H264",
        "width": 720,
        "height": 540,
        "link": "https://player.vimeo.com/progressive_redirect/playback/.../video.mp4",
        "created_time": "2018-08-27T14:58:07+00:00",
        "size": 2876666,
        "fps": 29.97
      }
    ]
  }
}

However, recently, the API response has changed, and I am only receiving this:

{
  "play": {
    "status": "playable"
  }
}

This is causing my app to break, as the progressive field is no longer included. I haven’t made any changes to my code or the API call in my Flutter app, but the integration has suddenly stopped working.

I am using a Vimeo Plus membership.

I have tried checking this using Postman. here is my flutter code for refreance:

class VimeoManager {
  static final VimeoManager _instance = VimeoManager._internal();
  static VimeoManager get instance => _instance;
  final String accessToken;

  VimeoManager._internal() : accessToken = const String.fromEnvironment('VIMEO_ACCESS_TOKEN');

  Future<VimeoVideoInfo> fetchVimeoVideoData(String videoId) async {
    final apiUrl = Uri.parse('https://api.vimeo.com/videos/$videoId?fields=play,name,pictures');
    final response = await http.get(apiUrl, headers: {
      AUTHORIZATION: 'Bearer $accessToken',
    });

    if (response.statusCode != 200) {
      Logger().e('Failed to load video data');
      throw Exception('Failed to load video data');
    }

    final Map<String, dynamic> json = jsonDecode(response.body);

    // Use the VimeoVideo model to parse the JSON response
    final vimeoVideo = VimeoVideo.fromJson(json);

    final thumbnailURLs = <VimeoThumbnailQuality, Uri>{};
    final videoURLs = <VimeoVideoQuality, Uri>{};

    // Extract video URLs
    final play = vimeoVideo.play;
    if (play != null) {
      final progressive = play.progressive;
      if (progressive != null) {
        for (final video in progressive) {
          final qualityString = video.rendition;
          final quality = qualityString?.toVimeoVideoQuality() ?? VimeoVideoQuality.unknown;
          final urlStr = video.link;
          if (quality != VimeoVideoQuality.unknown && urlStr != null) {
            videoURLs[quality] = Uri.parse(urlStr);
          }
        }
      }
    }

    // Extract thumbnail URLs
    final pictures = vimeoVideo.pictures;
    if (pictures != null) {
      final sizes = pictures.sizes;
      if (sizes != null) {
        for (final size in sizes) {
          final qualityString = '${size.width}x${size.height}';
          final quality = qualityString.toVimeoThumbnailQuality();
          if (quality != VimeoThumbnailQuality.qualityUnknown && size.link != null) {
            thumbnailURLs[quality] = Uri.parse(size.link!);
          }
        }
      }
    }

    // Extract video title
    final name = vimeoVideo.name;
    if (name == null) {
      throw Exception('Invalid JSON format from Vimeo');
    }

    return VimeoVideoInfo(
      title: name,
      thumbnailURL: thumbnailURLs,
      videoURL: videoURLs,
    );
  }
}

I’m wondering if this is an issue from Vimeo’s side or if there is something I missed in my API request. Can someone help me understand why the progressive field is missing from the response, and how to handle this issue?


Solution

  • the Vimeo account must be on a free plan or a plus plan(legacy), which doesn't have access to Vimeo video files. As stated in documentation, accessing video files via the API requires a Standard (or higher) plan, or the legacy Pro plan (or higher).