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

Please click here to watch this video on YouTube, video not loading #483

Open
kaungkhantsoe opened this issue Nov 25, 2019 · 12 comments
Open
Labels

Comments

@kaungkhantsoe
Copy link

kaungkhantsoe commented Nov 25, 2019

I have weird issue in my app since youtube changed the policy. I can play any video if i play with my wifi connection. But I can't play with my cellular connection. It shows "Please click here to watch this video on YouTube" when I try to play with my cellular network.

@PierfrancescoSoffritti
Copy link
Owner

I just tried, it works fine for me.

@kaungkhantsoe
Copy link
Author

This is how I load the video -

      getLifecycle().addObserver(youTubePlayerView);
      youTubePlayerView.addYouTubePlayerListener(new AbstractYouTubePlayerListener() {
        @Override
        public void onReady(@NonNull YouTubePlayer youTubePlayer) {
              youTubePlayer.loadVideo(strMovieId, 0);
        }
    });

This is how I declare in xml -

       <com.pierfrancescosoffritti.androidyoutubeplayer.core.player.views.YouTubePlayerView
        android:id="@+id/youtube_player_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:showFullScreenButton="false" />

These happen sometimes -

image

This video shows sometimes there is an error in playing

https://my.pcloud.com/publink/show?code=XZt6AYkZyXcEn0zlks8w49AI6abskF1mrRbX

But I could load the video when I change

           youTubePlayer.loadVideo(strMovieId, 0); 

to

            YouTubePlayerUtils.loadOrCueVideo(
                    youTubePlayer,
                    getLifecycle(),
                    strMovieId,
                    0
            );

After that I changed it back to

           youTubePlayer.loadVideo(strMovieId, 0); 

Since I thought there is a bug in loadVideo, but it didn't. It works fine somehow. I don't know how did it solve but I could load the videos now. Is there some cache for it to load the video? Bcuz there are 4 of us who have installed the testing app and only I can play the video since I did like the above. I called the others to check the app and they still can't play the video.

@PierfrancescoSoffritti
Copy link
Owner

The issue is most likely on YouTube/video publisher's side. Not in the library.

@kaungkhantsoe
Copy link
Author

I have 3 apps using this library and I've installed them in my device. Before I made the change like above. None of those 3 apps works. It says "click here to watch this on youtube" in all of those 3 apps. But after I've changed in one app from loadVideo to loadOrCue, now I can play in all of the apps. Just one issue, sometime it shows "error playing" but when I reload the video, the error always goes away somehow. Like I said, I have no idea how it got solved.

@bipendras
Copy link

Its also not working on the sample app.

@PierfrancescoSoffritti
Copy link
Owner

What is not working?
again this doesn't seem to be an issue with the library itself.

@BigBangKing
Copy link

Hi PierfrancescoSoffritti,
I got the similar issue. With video ID provided on your sample code and also with other video ID from YouTube. The video is not played and shows warning similar to the one provided by kaungkhantsoe.

Can you please check the project again and try connecting with different IP's?


Also this crashes on emulator (api 25) but doesn't crash real device but the warning is shown.

@KrishnaSoftwareSolution

Hi PierfrancescoSoffritti,
I got the similar issue. Please click here to watch video on YouTube.

@kaungkhantsoe
Copy link
Author

I think it happens when there is poor internet connection. I've tested that with my office wifi and it shows " Please click here to watch " sentence. Then I tested with my mobile data and it went well. But one of my colleagues also tested with his phone on mobile data too and he got the sentence. After a few minutes later he tested again ( He played the same movie which he couldn't the last time ) and suddenly he could play the movie again. So I think it depends on our mobile data speed. 4G with full bar will play when 4G with one bar may not.

@jobayer
Copy link

jobayer commented May 30, 2020

This issue still exists. But the problem is, it does not happen every time. I have noticed that, the error mostly happens whenever I open my app for the first time after installation. If I open the app for the second or higher time, then video plays without any issue. So, I don't think that it is a problem with any specific channel or video. Because if this would be correct, then why most of the time, it happens only for the first time and then automatically get resolved from the next time!! May be the library is facing some issues while initializing itself for the first time in a device after installation. Please do something :-( This is the only complete solution other than YouTube Data API to be used for my daily professional purposes.

@hamzaaltaf
Copy link

Problem still exists, we are facing the same issue.

@dev-mgkaung
Copy link

dev-mgkaung commented Jun 9, 2020

Problem still exists, we are facing the same issue.

This lib is the best youtubeplayerlib for me but it sometimes issues occur.
I can play any video if i play with my wifi connection. But I can't play with my cellular connection. It shows "Please click here to watch this video on YouTube" when I try to play with my cellular network.

I think that this is proxy error. So. I used SuperVPN application. When conneting vpn proxy, I can play video.

Can you please check the project again and try connecting with different IP's?

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

No branches or pull requests

8 participants