Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vimeo videos not working: Missing "progressive" #182

Open
greatschism opened this issue Apr 9, 2024 · 23 comments
Open

Vimeo videos not working: Missing "progressive" #182

greatschism opened this issue Apr 9, 2024 · 23 comments

Comments

@greatschism
Copy link

greatschism commented Apr 9, 2024

===== VIMEO API ERROR: type 'Null' is not a subtype of type 'List<dynamic>' in type cast ==========

I am not sure what the problem is here, but it stopped at 130pm yesterday suddenly.

@Danzzel
Copy link

Danzzel commented Apr 10, 2024

Yeah, all video are broken

@AhsanFarooq0017
Copy link

===== VIMEO API ERROR: type 'Null' is not a subtype of type 'List<dynamic>' in type cast ==========

I am not sure what the problem is here, but it starts suddenly.

Hey did you find any solution?

@greatschism
Copy link
Author

greatschism commented Apr 10, 2024

The code below works in a tester app. But when I try to run it in my main app, it starts playing and then crashes. I contacted Vimeo support regarding the issue, but they haven't been very helpful. The problem seems to be that the progressive key and data are missing and only HLS and DASH are available. I don't know how to repackage it either.

    String videoId,
    String? hash,
  ) async {
    try {
      final response = await _makeRequestHash(videoId, hash);
      var jsonData = <dynamic>[];
      var progressiveUrls = <VideoQalityUrls>[];
      // print(response.body);
      // print the key value pair of the response
      // is jsonDecode(response.body is a map or a list or something else
      // if it is a map, then proceed, else fail

      if (jsonDecode(response.body) is Map) {
        print("response.body is a map");
      } else {
        print("response.body is not a map");
      }

      if (jsonDecode(response.body)['request']['files']['progressive'] != null) {
        jsonData = jsonDecode(response.body)['request']['files']['progressive'] as List<dynamic>;
        print(jsonData);
        progressiveUrls = List.generate(
          jsonData.length,
          (index) => VideoQalityUrls(
            quality: int.parse(
              (jsonData[index]['quality'] as String?)?.split('p').first ?? '0',
            ),
            url: jsonData[index]['url'] as String,
          ),
        );
      }
      if (progressiveUrls.isEmpty && jsonDecode(response.body)['request']['files']['hls'] != null) {
        final jsonRes = jsonDecode(response.body)['request']['files']['hls']['cdns'];

        for (final element in (jsonRes as Map).entries.toList()) {
          progressiveUrls.add(
            VideoQalityUrls(
              quality: 720,
              url: element.value['url'] as String,
            ),
          );
          break;
        }
      }

      if (progressiveUrls.isEmpty && jsonDecode(response.body)['request']['files']['dash'] != null) {
        jsonData = jsonDecode(response.body)['request']['files']['dash']['cdns'] as List<dynamic>;

        progressiveUrls = List.generate(
          jsonData.length,
          (index) => VideoQalityUrls(
            quality: int.parse(
              (jsonData[index]['quality'] as String?)?.split('p').first ?? '0',
            ),
            url: jsonData[index]['url'] as String,
          ),
        );
      }
      return progressiveUrls;
    } catch (error) {
      if (error.toString().contains('XMLHttpRequest')) {
        log(
          podErrorString(
            '(INFO) To play vimeo video in WEB, Please enable CORS in your browser',
          ),
        );
      }
      debugPrint('===== 1VIMEO API ERROR: $error ==========');
      rethrow;
    }
  }```

@greatschism greatschism changed the title Vimeo stopped playing videos. Vimeo videos not working: Missing "progressive" Apr 10, 2024
@greatschism
Copy link
Author

greatschism commented Apr 10, 2024

response from Vimeo:

Hello,

Thank you for your inquiry. I can see you are using the player/config URL https://player.vimeo.com/video/{video_id}/config to retrieve the Video's metadata.

The player/config URL is not the correct way to retrieve a video's Metadata or Video links. This was an unpublished url and was only designed for the player's internal backend and was never published for public use. This internal player URL is also no longer being maintained and has been deprecated I believe for at least the last 2-3 years.

Instead, you should use the videos API endpoint as shown in our documentation. This will return a Videos complete metadata information. Please see https://developer.vimeo.com/api/reference/videos#get_video on how to use the endpoint along with https://developer.vimeo.com/api/reference/response/video which will show you all available responses and definitions.
Thank you,

@newtaDev
Copy link
Owner

response from Vimeo:

Hello,

Thank you for your inquiry. I can see you are using the player/config URL https://player.vimeo.com/video/{video_id}/config to retrieve the Video's metadata.

The player/config URL is not the correct way to retrieve a video's Metadata or Video links. This was an unpublished url and was only designed for the player's internal backend and was never published for public use. This internal player URL is also no longer being maintained and has been deprecated I believe for at least the last 2-3 years.

Instead, you should use the videos API endpoint as shown in our documentation. This will return a Videos complete metadata information. Please see https://developer.vimeo.com/api/reference/videos#get_video on how to use the endpoint along with https://developer.vimeo.com/api/reference/response/video which will show you all available responses and definitions. Thank you,

Hey, Thanks for reaching out to Vimeo and finding a solution,
But for some reason, the API they provided here is not working as expected
could you please check with them and get back?

The API they mentioned: (https://developer.vimeo.com/api/reference/videos#get_video )

GET Request:
https://api.vimeo.com/videos/518228118

Response:

{
    "error": "Something strange occurred. Please get in touch with the app's creator.",
    "link": null,
    "developer_message": "The app didn't receive the user's credentials.",
    "error_code": 8003
}

@chatali96
Copy link

Let us know when the VIMEO API ERROR gets resolved.

@mateusfmfm
Copy link

Thx guys, I had the same problem

@newtaDev
Copy link
Owner

fixed this issue in pod_player: ^0.2.2
please check and let me know

@AhsanFarooq0017
Copy link

fixed this issue in pod_player: ^0.2.2 please check and let me know

I can not update the dependency because my app is old can you tell me any work around?

@edwardnagy
Copy link

@AhsanFarooq0017 You could clone the compatible version and apply the fix locally.

@Danzzel
Copy link

Danzzel commented Apr 11, 2024

fixed this issue in pod_player: ^0.2.2 please check and let me know

I needed to upgrade a lot of packages but now it works fine. Thx a lot

@AhsanFarooq0017
Copy link

@AhsanFarooq0017 You could clone the compatible version and apply the fix locally.

can you please share the complete solution?

@aaronm67
Copy link

aaronm67 commented Apr 11, 2024

Please do not use the /config URL here, this is an internal API that changes without notice, so this library will break again in the future, and access to this URL will likely be disallowed in the future. Vimeo has a REST API that should be used, and has all of the data you need https://developer.vimeo.com/api/guides/start

@HasithaAcc
Copy link

HasithaAcc commented Apr 11, 2024

I have updated the plugin with out an error but after updating to 0.2.2 video sound is not coming

this happens when we use vemio id with the hash

@greatschism
Copy link
Author

greatschism commented Apr 12, 2024

Please do not use the /config URL here, this is an internal API that changes without notice, so this library will break again in the future, and access to this URL will likely be disallowed in the future. Vimeo has a REST API that should be used, and has all of the data you need https://developer.vimeo.com/api/guides/start

How do you return a player that does not need auth and does not expire?

@aaronm67
Copy link

aaronm67 commented Apr 12, 2024

How do you return a player that does not need auth and does not expire?

You don't, this is intentional. You should use the REST API to get video links, which requires registering an app on https://developer.vimeo.com.

Your users can register an app on https://developer.vimeo.com and configure this player with their access token. There are many different access tokens you can use, you can generate a "public" access key that doesn't have write permission, but we still require authentication for rate limiting purposes. Details of different types of access tokens are available here: https://developer.vimeo.com/api/guides/start#generate-access-token

If you don't wish to use the REST API, there is an OEmbed API that doesn't require authentication, https://developer.vimeo.com/api/oembed. This is only available for the Vimeo Player, not direct video links, so you'd need to embed an iFrame to support this.

Fully anonymous access to direct video files is not supported. The config URL you're currently using is an internal API that will change without notice, and will not be permanently available.

@robertjones26
Copy link

I cam across this and had to add the header with token. I searched for a couple of days and I think something changed on Vimeos side.

header = {
'Authorization': 'bearer {token}',
'Accept': 'application/vnd.vimeo.*+json;version=3.4',
};

@AAber
Copy link

AAber commented May 9, 2024

I had this issue with the /config API and once I moved to the official token API the progressive issue was resolved.
If your app presents videos from multiple Vimeo accounts you will need to connect the Vimeo accounts or use multiple tokens.
If you can't connect the Vimeo accounts make sure your app has a matching token for each Vimeo account you use.

@panalgin
Copy link

It seems like we are no longer be able to retrieve video file links without a Pro Plan on Vimeo, with their official REST API

image

@hgndgn
Copy link

hgndgn commented Jul 3, 2024

I had this issue with the /config API and once I moved to the official token API the progressive issue was resolved. If your app presents videos from multiple Vimeo accounts you will need to connect the Vimeo accounts or use multiple tokens. If you can't connect the Vimeo accounts make sure your app has a matching token for each Vimeo account you use.

How are you playing the videos?

@AAber
Copy link

AAber commented Jul 3, 2024

I'm using https://pub.dev/packages/pod_player in my Flutter app.

@hgndgn
Copy link

hgndgn commented Jul 3, 2024

I'm using https://pub.dev/packages/pod_player in my Flutter app.

@AAber Yeah me too, but playing the video using the id and the hash does not work anymore, therefore I asked. I couldn't find any API-endpoint, where I can pass the hash of the video.

@AAber
Copy link

AAber commented Jul 3, 2024

Use this snip to play the URL you get from the API:

  void initState() {
    controller = PodPlayerController(
        playVideoFrom: PlayVideoFrom.vimeo(widget.vimeoID),
        podPlayerConfig: PodPlayerConfig(
            videoQualityPriority: [360, 720, 1080], forcedVideoFocus: true))
      ..initialise();
    if (widget.videoUrls != null) {
      if (widget.videoUrls!.length != 0) {
        print('init controller');
        controller = PodPlayerController(
            playVideoFrom: PlayVideoFrom.networkQualityUrls(
              videoUrls: widget.videoUrls!,
            ),
            podPlayerConfig: PodPlayerConfig(
                videoQualityPriority: [360, 720, 1080], forcedVideoFocus: true))
          ..initialise();
      }
      super.initState();
    }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests