newtaDev / pod_player

Video player for flutter web & mobile devices, Play video from youtube or vimeo or network in flutter using pod player
https://pub.dev/packages/pod_player
MIT License
106 stars 202 forks source link

Vimeo API Error #212

Open mfurkanyuceal opened 5 months ago

mfurkanyuceal commented 5 months ago

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

panalgin commented 5 months ago

I'm having the same problem

chatali96 commented 5 months ago

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

chatali96 commented 5 months ago

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
Jojo974 commented 5 months ago

I have had the same problem for several days

panalgin commented 5 months ago

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

Jefriluqman commented 4 months ago

still same got the error

Jefriluqman commented 4 months ago

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

Jefriluqman commented 4 months ago

yes the video id is available on vimeo

DkRocks25 commented 4 months ago

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

hgndgn commented 4 months ago

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 commented 4 months ago

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

warrenrodrigues commented 4 months ago

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

hussainxaniar commented 4 months ago

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.

ahsanfarooq6414 commented 4 months ago

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.

hgndgn commented 4 months ago

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()
benja8151 commented 4 months ago

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.

ahsanfarooq6414 commented 4 months ago

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?

hgndgn commented 4 months ago

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?

benja8151 commented 4 months ago

@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.

JAYTARPARA commented 4 months ago

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.

hgndgn commented 4 months ago

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 :)

JAYTARPARA commented 4 months ago

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.

hgndgn commented 4 months ago

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
Aman8996622 commented 4 months ago

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

mfurkanyuceal commented 4 months ago

@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.

hgndgn commented 4 months ago

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

mfurkanyuceal commented 4 months ago

@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?

hgndgn commented 4 months ago

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

mfurkanyuceal commented 4 months ago

@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 commented 4 months ago

@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,
                                      ),
                                    ),
chathuranga1992 commented 3 months ago

@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.

this is happening to me when Unlisted URL's apart from my Vimeo account. For My account's Unlisted videos getting all Progressive,hls & dash sections Screenshot 2024-08-22 at 08 12 20 Screenshot 2024-08-22 at 08 13 15

nikunjshaligram commented 3 months ago

podPlayerController = PodPlayerController( playVideoFrom: PlayVideoFrom.network( vimeoVideoLink!, videoPlayerOptions: VideoPlayerOptions( allowBackgroundPlayback: true, ), ), podPlayerConfig: const PodPlayerConfig( autoPlay: false, isLooping: false, wakelockEnabled: true, ), )..initialise();

      I am using this code but not work in android and ios. Is there any solution for vimeo url play a video?
chathuranga1992 commented 3 months ago

podPlayerController = PodPlayerController( playVideoFrom: PlayVideoFrom.network( vimeoVideoLink!, videoPlayerOptions: VideoPlayerOptions( allowBackgroundPlayback: true, ), ), podPlayerConfig: const PodPlayerConfig( autoPlay: false, isLooping: false, wakelockEnabled: true, ), )..initialise();

      I am using this code but not work in android and ios. Is there any solution for vimeo url play a video?

you have to get personal access token from your vimeo developer console to get streaming data according to above discussion.

nikunjshaligram commented 3 months ago

I have to found this error, so how to resolved :

Initialization error: Exception: videoQuality cannot be empty

Kingofalltimes commented 2 months ago

Has anyone found a solution for this Vimeo player issue?

mohamed-belal1 commented 1 month ago

I have the same issue, how can there's no solution to play vimeo videos in flutter...

Quwaysim commented 1 day ago

The exact same issue here too