GithubHelp home page GithubHelp logo

yt-android-player's Introduction

yt-android-player's People

Contributors

ulukaya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yt-android-player's Issues

YouTube Sdk : Remove Ads from YouTubePlayer

I have used YouTube sdk for playing YouTube video in it. I want to remove ads in youtube player. Is it possible to remove ads from YouTubePlayer.

I have used "player!!.cueVideo(Url)"

I have used this sample code for YouTube sdk.

Please help me.

YoutubePlayerFragment loading always

I'm using YoutubePlayerFragment to play youtube video in my app.
I have activityA, and activityB contain YoutubePlayerFragment.
First I open app and play youtube video in activityA, everything work perfectly. Then I open activity B, play youtube video in here, It's work perfect. After that, I back to activity A, It's loading forever?

Please tell me what something wrong here?

android having problem when i am using framelayout for fragment youtube player

i have this error out of unknown
please note that i discard all views on my xml and i am getting this error over and over again even of the xml having just framelayout to display youtube fragment

YouTubeAndroidPlayerAPI: YouTube video playback stopped due to unauthorized overlay on top of player. The YouTubePlayerView is obscured by com.google.android.youtube.player.YouTubePlayerView{1aa23167 V.E..... ........ 0,0-1080,607}. YouTubePlayerView is completely covered, with the distance in px between each edge of the obscuring view and the YouTubePlayerView being: left: 0, top: 0, right: 0, bottom: 0..

please help me it happend to me in two fragment and i am discarding all xml views i just put framelayout

NullPointerException at onFilterTouchEventForSecurity

This error is quite popular now:

https://stackoverflow.com/questions/45172972/getting-nullpointerexception-at-onfiltertoucheventforsecurity

https://stackoverflow.com/questions/45857554/getting-lot-of-crashes-in-youtube-player-api

https://stackoverflow.com/questions/51654151/nullpointerexception-in-onfiltertoucheventforsecurity-with-youtubebaseactivity

and I guess this one too https://stackoverflow.com/questions/45003133/nullpointerexception-at-onfiltertoucheventforsecurity

(all users from StackOverflow use YouTube Android Player API)

Reports from Google Console

image

image

image

java.lang.NullPointerException: 
  at ipf.onFilterTouchEventForSecurity(ipf.java:115)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2351)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2844)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2461)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2844)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2461)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2844)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2461)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2876)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2461)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2844)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2519)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2844)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2519)
  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2844)
  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2519)
  at com.android.internal.policy.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2840)
  at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1853)
  at android.app.Activity.dispatchTouchEvent(Activity.java:3061)
  at com.android.internal.policy.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2801)
  at android.view.View.dispatchPointerEvent(View.java:10246)
  at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5447)
  at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5283)
  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4721)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4774)
  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4740)
  at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4882)
  at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4748)
  at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4939)
  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4721)
  at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4774)
  at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4740)
  at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4748)
  at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4721)
  at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7429)
  at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7298)
  at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7259)
  at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7539)
  at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
  at android.os.MessageQueue.nativePollOnce(MessageQueue.java:0)
  at android.os.MessageQueue.next(MessageQueue.java:323)
  at android.os.Looper.loop(Looper.java:135)
  at android.app.ActivityThread.main(ActivityThread.java:7325)
  at java.lang.reflect.Method.invoke(Method.java:0)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Some videos are playing only once using this API

With most recent update of Youtube, the YTPlayer API is no more able to play all the video's just some videos are just playing only once. The example sample is also having the same issue.

Kindly fix the update.

youtube player gets crashed

I'm trying to play video using YouTube Android Player API. Even though I have video id, my application gets crashed saying "Unfortunately, Youtube has Stopped."
I'm getting videos using below api:
https://www.googleapis.com/youtube/v3/search?key=AIzaSyC1pCnqKowxxmITL4YIwsuYi6GEeaOgEtY&channelId=UCMEmNnHT69aZuaOrE-dF6ug&part=snippet,id&order=date&maxResults=20

This is logcat:

E/AndroidRuntime: FATAL EXCEPTION: main
                                                   Process: com.google.android.youtube.player, PID: 19410
                                                   java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String com.google.android.apps.youtube.core.utils.y.i()' on a null object reference
                                                       at com.google.android.apps.youtube.core.player.AdStatsMacros.a(SourceFile:185)
                                                       at com.google.android.apps.youtube.core.client.DefaultAdStatsClient.a(SourceFile:481)
                                                       at com.google.android.apps.youtube.core.client.DefaultAdStatsClient.a(SourceFile:467)
                                                       at com.google.android.apps.youtube.core.client.DefaultAdStatsClient.a(SourceFile:258)
                                                       at com.google.android.apps.youtube.core.player.StatsTracker.a(SourceFile:555)
                                                       at com.google.android.apps.youtube.core.player.Director.a(SourceFile:90)
                                                       at com.google.android.apps.youtube.core.player.ag.a(SourceFile:1562)
                                                       at com.google.android.apps.youtube.core.async.p.a(SourceFile:35)
                                                       at com.google.android.apps.youtube.core.async.bm.run(SourceFile:96)
                                                       at android.os.Handler.handleCallback(Handler.java:739)
                                                       at android.os.Handler.dispatchMessage(Handler.java:95)
                                                       at android.os.Looper.loop(Looper.java:135)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5254)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at java.lang.reflect.Method.invoke(Method.java:372)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

Here is code for YoutubePlayerActivity:

public class YoutubePlayerActivity extends YouTubeFailureRecoveryActivity {
    private YouTubePlayerView mYouTubePlayerView;
    private Item mItem;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.video_detail);
        mYouTubePlayerView = (YouTubePlayerView) findViewById(R.id.youtube_player_view);
        mItem = getIntent().getParcelableExtra(ITEM);
        mYouTubePlayerView.initialize(API_KEY, this);
    }

    @Override
    protected YouTubePlayer.Provider getYouTubePlayerProvider() {
        return mYouTubePlayerView;
    }

    @Override
    public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean wasRestored) {
        youTubePlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.DEFAULT);
        youTubePlayer.setFullscreen(true);
        youTubePlayer.setShowFullscreenButton(true);
        if (!wasRestored) {
            if(mItem.getId().getVideoId() != null) youTubePlayer.cueVideo(mItem.getId().getVideoId());
        }
    }
}

Here is code for YouTubeFailureRecoveryActivity :

public abstract class YouTubeFailureRecoveryActivity extends YouTubeBaseActivity implements YouTubePlayer.OnInitializedListener {
    private static final int RECOVERY_DIALOG_REQUEST = 1;

    @Override
    public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult errorReason) {
        if (errorReason.isUserRecoverableError()) {
            errorReason.getErrorDialog(this, RECOVERY_DIALOG_REQUEST).show();
        } else {
            String errorMessage = String.format(getString(R.string.error_player), errorReason.toString());
            Toast.makeText(this, errorMessage, Toast.LENGTH_LONG).show();
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == RECOVERY_DIALOG_REQUEST) {
            getYouTubePlayerProvider().initialize(API_KEY, this);
        }
    }

    protected abstract YouTubePlayer.Provider getYouTubePlayerProvider();
}

Please help, thanks.

Exception thrown by invoked constructor

When i run a project to show youtube video in Android Studio V2 it shows this error.
com.google.android.youtube.player.internal.w$a: Exception thrown by invoked constructor in com.google.android.youtube.api.jar.client.RemoteEmbeddedPlayer

YouTube API is not sync in Cyanogen OS

In Cyanogen OS , YouTube API video stuck at a point and audio continues playback . No sync between audio and video after that. This issue is 100% easily reproducible in Cyanogen OS. I checked with latest YouTube API 1.2.2. Issue is persist in the same version also. Hope you guys fixed this asap.

VideoListDemoActivity - Immediate notifyDataSetChanged

I have included a slight variation of the example code from VideoListDemoActivity in my app. In my case, VideoListFragment is initialised with some cached content, and simultaneously a request is made to update to the latest set of videos. This can come back relatively quickly, whilst the cached video thumbnails are still in some form of loading state (Usually "1) The view has not yet been created"). When the new data is returned, I call notifyDataSetChanged on the adapter. Sometimes this will cause an IllegalStateException:

java.lang.IllegalStateException: Not connected. Call connect() and wait for onConnected() to be called.
        at com.google.android.youtube.player.a.at.i(Unknown Source)
        at com.google.android.youtube.player.a.an.k(Unknown Source)
        at com.google.android.youtube.player.a.an.a(Unknown Source)
        at com.google.android.youtube.player.a.ao.<init>(Unknown Source)
        at com.google.android.youtube.player.a.f.a(Unknown Source)
        at com.google.android.youtube.player.s.a(Unknown Source)
        at com.google.android.youtube.player.a.at.g(Unknown Source)
        at com.google.android.youtube.player.a.ax.a(Unknown Source)
        at com.google.android.youtube.player.a.aw.a(Unknown Source)
        at com.google.android.youtube.player.a.av.handleMessage(Unknown Source)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5171)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:837)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:653)

I have managed to reproduce this consistently in my version. If I stop the notifyDataSetChanged, or even delay it by 0.5 seconds, there is no crash. Can you reproduce this too? Any suggestions what I should do in this case?

Thanks,
Jon.

YouTubeStandalonePlayer.createVideoIntent Showing black screen

I have implemented youtube video playing through YouTubeStandalonePlayer.createVideoIntent. For the first time immediately after the installation of the app, youtube video is playing . But from the next time onwards StandalonePlayerActivity is blank showing a black screen. When I put my app in the background and resume again then the video starts playing

Code implementaion
Intent intent = YouTubeStandalonePlayer.createVideoIntent(activity, BuildConfig.YOUTUBE_API_KEY, videoId);
activity?.startActivity(intent);

java.lang.IllegalStateException: android.os.Parcel.readException

java.lang.IllegalStateException: 
  at android.os.Parcel.readException (Parcel.java:1554)
  at android.os.Parcel.readException (Parcel.java:1499)
  at com.google.android.youtube.player.internal.l$a$a.a (l.java)
  at com.google.android.youtube.player.internal.o.a (o.java)
  at com.google.android.youtube.player.internal.ac.a (ac.java)
  at com.google.android.youtube.player.YouTubePlayerView.a (YouTubePlayerView.java)
  or                     .b (YouTubePlayerView.java)
  or                     .initialize (YouTubePlayerView.java)
  at com.google.android.youtube.player.YouTubePlayerView$1.a (YouTubePlayerView.java)
  at com.google.android.youtube.player.internal.r.g (r.java)
  at com.google.android.youtube.player.internal.r$c.a (r.java)
  at com.google.android.youtube.player.internal.r$b.a (r.java)
  at com.google.android.youtube.player.internal.r$a.handleMessage (r.java)
  at android.os.Handler.dispatchMessage (Handler.java:111)
  at android.os.Looper.loop (Looper.java:194)
  at android.app.ActivityThread.main (ActivityThread.java:5637)
  at java.lang.reflect.Method.invoke (Method.java)
  at java.lang.reflect.Method.invoke (Method.java:372)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:960)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:755)

also here https://stackoverflow.com/questions/27579834/java-lang-illegalstateexception-youtubeserviceentity-not-initialized-error-when (an issue isn't about YouTube Android Player Fragments version. I use YouTube Android Player only with activity and have the same issue: I get some reports from Google Console java.lang.IllegalStateException android.os.Parcel.readException)

image

Is this project dead?

There is no more stuff who support this or what? Project official closed, stuff moved to another project or left the company?

360 Video support

Do you know if 360 video support is planned?
I'd like to embed 360 video from youtube in my application. The only way that I see right now, is to do get a direct url from youtube video and use exoPlayer, but it would be against the youtube terms of service.

YouTube Android Player API INTERNAL_ERROR for multiple videos

Name of API affected: YouTube Android Player API

Issue summary:
Using the YouTube Android Player API sample code (version 1.2.2), if I change any of the video IDs over to one I have uploaded (e.g. "QVikru_w2hQ" or "u1n6E81rm80"), the thumbnail loads in the player, but on clicking play, the player goes to the onError function with YouTubePlayer.ErrorReason.INTERNAL_ERROR. Playing these videos on the YouTube website or our iOS app does not have a problem.

Steps to reproduce issue:

  1. Download YouTube Android Player API sample code (version 1.2.2).
  2. Download YouTube Android app version 11.13.56.
  3. Input developer key into player code.
  4. Change any sample class YouTube video ID to "QVikru_w2hQ".
  5. Run app and try to play video.

Expected output:
Video should play.

Actual results:
onError function called with YouTubePlayer.ErrorReason.INTERNAL_ERROR and message "There was a problem while playing. Tap to retry".

Notes:
I am experiencing this issue on multiple devices, including my Nexus 5X (android 6.0.1) with YouTube app version currently at 11.13.56.

*Logcat: *

05-08 11:25:22.145 20521-20521/? E/YouTubeAndroidPlayerAPI: fmt.noneavailable
oae: Video not supported/available
at oab.a(SourceFile:212)
at nvl.a(SourceFile:383)
at nvl.a(SourceFile:706)
at nvr.a(SourceFile:1144
at nsn.onPostExecute(SourceFile:2102)
at android.os.AsyncTask.finish(AsyncTask.java:651)
at android.os.AsyncTask.-wrap1(AsyncTask.java)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

The problem seems related to the date of publication of the video... In the last week of April I posted many videos on YouTube, those published up to 19:00 of April 27 work properly, while those charged by 21:15 on the same day have the issue discussed, as if between 19 and 21 of April 27 had been introduced a few updates or changes to the videos by YouTube. I tried to load a new video just now and this also has the same problem.

Black screen on youtube website on chrome android after fullscreen on pressing screen lock button.

From "Settings > About Chrome"
Application version:
Operating system:

URLs (if applicable):

Steps to reproduce:
(1) Open Youtube on Chrome Tab.
(2) Click on a video and go full screen.
(3) Press the screen lock button on the side.

Expected result: The video on youtube running on full-screen mode can be minimized back to original viewport, and it can be can run again on full-screen mode after going back to the tab which was playing the video.

Actual result: The video screen gets blacked out with audio playing normally. No video output on the screen. The full-screen mode for playing the video presents only a black screen.

I have reproduced the result on the chrome browser and Andriod sandbox.

Gerrit Issue Link

Layout with Toolbar

Hi,

i use ToolBar with ActionBarActivity, but the list of video is above the ToolBar..how i can fixed it?

YouTube API onInitializationFailure SERVICE_MISSING on Android 11 (SDK 30)

YouTube Android Player API (https://developers.google.com/youtube/android/player) doesn't work on Android 11 (SDK 30).

youTubePlayerView.initialize(DEVELOPER_KEY, this)

and error callback is trigged for Android 11:

override fun onInitializationFailure(p0: YouTubePlayer.Provider?, p1: YouTubeInitializationResult?) {
    Log.e(TAG, "onInitializationFailure $p0 $p1")
}

Error:

onInitializationFailure
com.google.android.youtube.player.YouTubePlayerView{81eb47c V.E......
......ID 0,0-1080,1794 #7f0801af app:id/youTubePlayerView}
SERVICE_MISSING

I checked on emulator with Android 10 (SDK 29) and it works fine.

YouTube app version is 15.43.32 (for both emulators)

From documentation https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubeInitializationResult

YouTubeInitializationResult.SERVICE_MISSING:

The YouTube API service is missing on this device.

But how it can be missing? YouTube app (same version) and Google Play services are installed on both Pixel SDK 29/30 emulators

Are there some changes on Android 11?

The same question on SO https://stackoverflow.com/questions/64631893/youtube-api-oninitializationfailure-service-missing-on-android-11-sdk-30

Overlay back button on top of youtube player

Hi I want to overlay the back button on top of youtube player. I used the actionbar for this
but problem is action bar is also covering the menu icon of the youtube player so it cannot be clicked.Also i wanted to is doing so violate the player Terms of service.
Any help is deeply appreciated , thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.