Reputation: 135
I have implement Agora SDK for live video stimming in android app. I want to add multiple videos on Recycler View. When I use below code screen shown blank.
` @Override public void onBindViewHolder(final DataAdapter.ViewHolder holder, final int position) {
rtcEngine().setClientRole(Constants.CLIENT_ROLE_AUDIENCE);
TestLive model = data.get(position);
RelativeLayout.LayoutParams videoLayoutParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
SurfaceView surfaceView = model.getSurface();
surfaceView.getHolder().setFormat(PixelFormat.TRANSPARENT);
surfaceView.setZOrderOnTop(true);
holder.relContainer.addView(surfaceView, videoLayoutParams);
}`
Upvotes: 1
Views: 329
Reputation: 400
If I understand correctly, you are trying to have a transparent background for your video container. If that's the case, I would recommend you use a TextureView instead. You can see the Agora API Reference regarding that here: https://docs.agora.io/en/Video/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_rtc_engine.html#ae12df01b67f756ce4abdeba4b08242e4
You can then do something like this
TextureView.setOpaque(false);
Upvotes: 1