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

Error inflating class VideoPlayerView #64

Closed
DebdeepG opened this issue May 8, 2017 · 3 comments
Closed

Error inflating class VideoPlayerView #64

DebdeepG opened this issue May 8, 2017 · 3 comments

Comments

@DebdeepG
Copy link

DebdeepG commented May 8, 2017

I did follow the exact steps with my RecyclerView but cannot inflate the VideoPlayerView inside the row. Help is greatly appreciated !
Here's a part of my logcat, adapter's onCreateView and Model:
android.view.InflateException: Binary XML file line #66: Error inflating class

                                                                   at android.view.LayoutInflater.createView(LayoutInflater.java:633)
                                                                   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
                                                                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
                                                                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
                                                                   at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
                                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
                                                                   at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
                                                                   at com.enthu.nocto.models.userInsightFeed.Insight.createView(Insight.java:409)
                                                                   at com.enthu.nocto.views.adapters.InsightsAdapter.onCreateViewHolder(InsightsAdapter.java:80)
                                                                   at com.enthu.nocto.views.adapters.InsightsAdapter.onCreateViewHolder(InsightsAdapter.java:50)
                                                                   at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6367)
                                                                   at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5555)```



@Override
    public VideoViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
	    Insight insight = mInsightList.get(viewType);
	    View resultView = insight.createView(parent, mContext.getResources().getDisplayMetrics().widthPixels);
	    return new VideoViewHolder(resultView);
    }



public View createView(ViewGroup parent, int screenWidth) {
		View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_adapter_insights, parent, false);
		ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
		layoutParams.height = screenWidth;
		final VideoViewHolder videoViewHolder = new VideoViewHolder(view);
		view.setTag(videoViewHolder);

		videoViewHolder.mVideoPlayerView.addMediaPlayerListener(new MediaPlayerWrapper.MainThreadMediaPlayerListener() {
			@Override
			public void onVideoSizeChangedMainThread(int width, int height) {

			}

			@Override
			public void onVideoPreparedMainThread() {
				videoViewHolder.mVCover.setVisibility(View.GONE);
			}

			@Override
			public void onVideoCompletionMainThread() {
				videoViewHolder.mVCover.setVisibility(View.VISIBLE);
			}

			@Override
			public void onErrorMainThread(int what, int extra) {
				videoViewHolder.mVCover.setVisibility(View.VISIBLE);
			}

			@Override
			public void onBufferingUpdateMainThread(int percent) {

			}

			@Override
			public void onVideoStoppedMainThread() {
				videoViewHolder.mVCover.setVisibility(View.VISIBLE);
			}
		});


		return view;
	}
@developerGM
Copy link

Please check if in your XML you are using android:visibility="gone"
In this case and in some devices (I don't know why) this can be a problem, so try to delete "visibility" attribute from XML

@DebdeepG
Copy link
Author

Yes, exactly. Also after managing it programmatically, other issues are arising inside RecyclerView onScroll. Also If we have our own response models from api, how do we use the DirectLinkVideoItem ?

@DebdeepG
Copy link
Author

Other than a few things like IllegalStateException: cannot stop. Player in mState ERROR and exception in ListItemData and SingleListViewItemActiveCalculator , the videos work great on list :) . This library is so simple and easy to use, kudos! 👍 :)

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

2 participants