pod_player icon indicating copy to clipboard operation
pod_player copied to clipboard

Vimeo API Error

Open mfurkanyuceal opened this issue 1 year ago • 37 comments

image

There is a problem with Vimeo videos. Videos cannot be played. Flutter 3.22.2 Dart 3.4.3 pod_player: ^0.2.2

mfurkanyuceal avatar Jun 22 '24 17:06 mfurkanyuceal

I'm having the same problem

panalgin avatar Jun 25 '24 15:06 panalgin

flutter: ===== VIMEO API ERROR: FormatException: Unexpected character (at character 1) flutter: flutter: ^ flutter: ========== [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: FormatException: Unexpected character (at character 1)

chatali96 avatar Jun 26 '24 03:06 chatali96

try { final response = await _makeRequestHash(videoId, hash); final jsonData = jsonDecode(response.body)['request']['files']['progressive']; }

      here progressive field is null thats why jsonData also null
      
      player is not able to play video anymore

chatali96 avatar Jun 26 '24 04:06 chatali96

I have had the same problem for several days

Jojo974 avatar Jun 26 '24 16:06 Jojo974

see #182 , seems like vimeo closed unofficial /config endpoint for fetching video links

panalgin avatar Jun 26 '24 16:06 panalgin

still same got the error

Jefriluqman avatar Jul 03 '24 05:07 Jefriluqman

Screenshot 2024-07-03 at 1 56 47 PM I receive this error

Jefriluqman avatar Jul 03 '24 05:07 Jefriluqman

yes the video id is available on vimeo

Jefriluqman avatar Jul 03 '24 06:07 Jefriluqman

I am facing the same issue, It was working some days back but suddenly stopped working.

Please let me know if someone has found a fix as my app already in production. Thanks. Screenshot 2024-07-03 at 1 15 34 PM

DkRocks25 avatar Jul 03 '24 07:07 DkRocks25

I'm also facing the same issue. I played private videos until last Monday. Now it doesn't work for either private or public Vimeo videos...

pod_player: 0.2.2 Flutter 3.19.2 Dart 3.3.0

hgndgn avatar Jul 03 '24 08:07 hgndgn

I am facing the same issue, It was working some days back but suddenly stopped working. Please let me know if someone has found a fix as my app already in production. Thanks. Screenshot 2024-07-03 at 1 15 34 PM

this was the same issue i was facing. this issue is solved in my git url please remove first pod_player :^0.2.2 add like this in pubspec.yaml :

image

This doesn't work for me too. I get this error:

Cannot initialize video player: Exception: videoQuality cannot be empty #0

hgndgn avatar Jul 03 '24 09:07 hgndgn

I am facing the same issue, It was working some days back but suddenly stopped working. Please let me know if someone has found a fix as my app already in production. Thanks. Screenshot 2024-07-03 at 1 15 34 PM

this was the same issue i was facing. this issue is solved in my git url please remove first pod_player :^0.2.2 add like this in pubspec.yaml :

image

That points to your forked repo of the project, where you have hard-coded a bearer token. This is not a long-term solution.

image

warrenrodrigues avatar Jul 04 '24 16:07 warrenrodrigues

I'm having the same issue recently. the @anantnimbalkar solution is not working for me either. I'll be looking into this issue to see if someone will find a working solution.

hussainxaniar avatar Jul 05 '24 02:07 hussainxaniar

Does anyone found any solution for this issue? as I am fetching the videos and when I try to play video using videoId it gives above mentioned error I dont know what is the issue with this package. Please any help in this regard will be a huge favor.

ahsanfarooq6414 avatar Jul 05 '24 11:07 ahsanfarooq6414

First you need a personal access token, which you can generate in your app settings. Then fetch the video information using this request:

curl  -X GET \
  'https://api.vimeo.com/videos/<video-id>?fields=play' \
  --header 'Accept: application/vnd.vimeo.*+json;version=3.4' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: bearer <personal-access-token>'

You can then initialise the PodPlayer like this:

controller = PodPlayerController(
        playVideoFrom: PlayVideoFrom.networkQualityUrls(
          videoUrls: [
            VideoQalityUrls(quality: 360,  url: '<the link for 360p>),
          ],
        ),
      )..initialise()

hgndgn avatar Jul 05 '24 11:07 hgndgn

First you need a personal access token, which you can generate in your app settings. Then fetch the video information using this request:

curl  -X GET \
  'https://api.vimeo.com/videos/<video-id>?fields=play' \
  --header 'Accept: application/vnd.vimeo.*+json;version=3.4' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: bearer <personal-access-token>'

You can then initialise the PodPlayer like this:

controller = PodPlayerController(
        playVideoFrom: PlayVideoFrom.networkQualityUrls(
          videoUrls: [
            VideoQalityUrls(quality: 360,  url: '<the link for 360p>),
          ],
        ),
      )..initialise()

Video links generated this way are only valid for 24 hours, so we would need to add requests to retrieve video links inside the app.

benja8151 avatar Jul 06 '24 06:07 benja8151

I am fetching videos in this function: Future<List> fetchVimeoVideos() async { final String vimeoAccessToken = 'access token';

// Construct the API request URL final String apiUrl = 'https://api.vimeo.com/me/videos?sort=date&direction=asc';

// Set the headers, including the access token final headers = { 'Authorization': 'Bearer $vimeoAccessToken', 'Content-Type': 'application/json', 'Accept': 'application/vnd.vimeo.*+json;version=3.4' };

// Send the HTTP GET request final response = await http.get(Uri.parse(apiUrl), headers: headers);

// Check if the request was successful if (response.statusCode == 200) { // Parse the response body final jsonResponse = jsonDecode(response.body); // Return the list of videos return jsonResponse['data']; } else { // Request failed, handle the error throw Exception('Failed to fetch Vimeo videos: ${response.statusCode}'); } } and after fetching videos I pas video id to podplayer: openVimeoPlayer(video['uri'].split('/').last); can you please tell what things do I need to change?

ahsanfarooq6414 avatar Jul 06 '24 07:07 ahsanfarooq6414

First you need a personal access token, which you can generate in your app settings. Then fetch the video information using this request:

curl  -X GET \
  'https://api.vimeo.com/videos/<video-id>?fields=play' \
  --header 'Accept: application/vnd.vimeo.*+json;version=3.4' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: bearer <personal-access-token>'

You can then initialise the PodPlayer like this:

controller = PodPlayerController(
        playVideoFrom: PlayVideoFrom.networkQualityUrls(
          videoUrls: [
            VideoQalityUrls(quality: 360,  url: '<the link for 360p>),
          ],
        ),
      )..initialise()

Video links generated this way are only valid for 24 hours, so we would need to add requests to retrieve video links inside the app.

@benja8151 Would you suggest any other/better solution?

hgndgn avatar Jul 08 '24 07:07 hgndgn

@benja8151 Would you suggest any other/better solution?

No, at a glance I think this solution should work, but you need to fetch video links (your curl request) on demand inside the app, parse response and add them to videoUrls as you suggested.

benja8151 avatar Jul 08 '24 09:07 benja8151

First you need a personal access token, which you can generate in your app settings. Then fetch the video information using this request:

curl  -X GET \
  'https://api.vimeo.com/videos/<video-id>?fields=play' \
  --header 'Accept: application/vnd.vimeo.*+json;version=3.4' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: bearer <personal-access-token>'

You can then initialise the PodPlayer like this:

controller = PodPlayerController(
        playVideoFrom: PlayVideoFrom.networkQualityUrls(
          videoUrls: [
            VideoQalityUrls(quality: 360,  url: '<the link for 360p>),
          ],
        ),
      )..initialise()

Why I am just getting status and not other things in API response. ? Any help would be appreciated.

JAYTARPARA avatar Jul 08 '24 12:07 JAYTARPARA

First you need a personal access token, which you can generate in your app settings. Then fetch the video information using this request:

curl  -X GET \
  'https://api.vimeo.com/videos/<video-id>?fields=play' \
  --header 'Accept: application/vnd.vimeo.*+json;version=3.4' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: bearer <personal-access-token>'

You can then initialise the PodPlayer like this:

controller = PodPlayerController(
        playVideoFrom: PlayVideoFrom.networkQualityUrls(
          videoUrls: [
            VideoQalityUrls(quality: 360,  url: '<the link for 360p>),
          ],
        ),
      )..initialise()

Why I am just getting status and not other things in API response. ? Any help would be appreciated.

@JAYTARPARA It can depend on the scope of your token. You can also remove the header "field=play" and see how the complete response looks like. And dude do not share your access token here :)

hgndgn avatar Jul 08 '24 12:07 hgndgn

First you need a personal access token, which you can generate in your app settings. Then fetch the video information using this request:

curl  -X GET \
  'https://api.vimeo.com/videos/<video-id>?fields=play' \
  --header 'Accept: application/vnd.vimeo.*+json;version=3.4' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: bearer <personal-access-token>'

You can then initialise the PodPlayer like this:

controller = PodPlayerController(
        playVideoFrom: PlayVideoFrom.networkQualityUrls(
          videoUrls: [
            VideoQalityUrls(quality: 360,  url: '<the link for 360p>),
          ],
        ),
      )..initialise()

image Why I am just getting status and not other things in API response. ? Any help would be appreciated.

@JAYTARPARA It can depend on the scope of your token. You can also remove the header "field=play" and see how the complete response looks like. And dude do not share your access token here :)

What should be the scope? Can you please let me know. I have removed the screenshot.

JAYTARPARA avatar Jul 08 '24 12:07 JAYTARPARA

First you need a personal access token, which you can generate in your app settings. Then fetch the video information using this request:

curl  -X GET \
  'https://api.vimeo.com/videos/<video-id>?fields=play' \
  --header 'Accept: application/vnd.vimeo.*+json;version=3.4' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: bearer <personal-access-token>'

You can then initialise the PodPlayer like this:

controller = PodPlayerController(
        playVideoFrom: PlayVideoFrom.networkQualityUrls(
          videoUrls: [
            VideoQalityUrls(quality: 360,  url: '<the link for 360p>),
          ],
        ),
      )..initialise()

image Why I am just getting status and not other things in API response. ? Any help would be appreciated.

@JAYTARPARA It can depend on the scope of your token. You can also remove the header "field=play" and see how the complete response looks like. And dude do not share your access token here :)

What should be the scope? Can you please let me know. I have removed the screenshot.

It depends on your needs. For example, I have these:

image

hgndgn avatar Jul 08 '24 12:07 hgndgn

hi @JAYTARPARA hi done the same thing but it doesn't working can any tell me correct solution of it

Aman8996622 avatar Jul 10 '24 17:07 Aman8996622

@hgndgn It doesn't work with the same settings.

Screenshot 2024-07-14 at 12 29 36 Screenshot 2024-07-14 at 12 28 15

There is no video link in the response returned.

mfurkanyuceal avatar Jul 14 '24 09:07 mfurkanyuceal

@mfurkanyuceal My videos are "Unlisted". Maybe therefore it works for me, I could check it later.

hgndgn avatar Jul 14 '24 09:07 hgndgn

@mfurkanyuceal My videos are "Unlisted". Maybe therefore it works for me, I could check it later.

I set it the same way but it didn't work. Could your Vimeo pricing plan be different?

mfurkanyuceal avatar Jul 14 '24 11:07 mfurkanyuceal

@mfurkanyuceal Yes it could be. I have a "Pro Plan".

hgndgn avatar Jul 14 '24 11:07 hgndgn

@mfurkanyuceal Yes it could be. I have a "Pro Plan".

Thank you. If the payment plan is a plus, we can say that it does not work.

mfurkanyuceal avatar Jul 14 '24 11:07 mfurkanyuceal

@hgndgn Thanks for the solution. When I join the Pro payment plan, I can get the links of the videos using the vimeo API. I have no problems with Android. However, I encountered the "Error while playing video" error on iOS. Do you have any relevant experience with this error?

image

          podPlayerController = PodPlayerController(
            playVideoFrom: PlayVideoFrom.network(
              vimeoVideoLink!,
              videoPlayerOptions: VideoPlayerOptions(
                allowBackgroundPlayback: true,
              ),
            ),
            podPlayerConfig: const PodPlayerConfig(
              autoPlay: false,
              isLooping: false,
              wakelockEnabled: true,
            ),
          )..initialise();
                                    AspectRatio(
                                      aspectRatio: 16 / 9,
                                      child: PodVideoPlayer(
                                        controller: trainerProfileController.podPlayerController!,
                                        videoAspectRatio: 16 / 9,
                                      ),
                                    ),

mfurkanyuceal avatar Jul 19 '24 18:07 mfurkanyuceal