我使用ExoPlayer并需要从另一个类调用私有函数:
调用函数:
getRendererBuilder(MediaSourceType, Uri, MediaUtil.MediaType)
我得到了MediaSourceType,Uri和MediaUtil.MediaType,因为这个函数隐藏在类中,它定义如下:
public class EMVideoView
extends RelativeLayout
implements AudioCapabilitiesReceiver.Listener, VideoTextureView.OnSizeChangeListener {
private RenderBuilder getRendererBuilder(MediaSourceType renderType, Uri uri, MediaUtil.MediaType defaultMediaType)
{
switch (renderType)
{
case HLS:
return new HlsRenderBuilder(getContext().getApplicationContext(), getUserAgent(), uri.toString());
case DASH:
return new DashRenderBuilder(getContext().getApplicationContext(), getUserAgent(), uri.toString());
case SMOOTH_STREAM:
return new SmoothStreamRenderBuilder(getContext().getApplicationContext(), getUserAgent(), uri.toString());
}
return new RenderBuilder(getContext().getApplicationContext(), getUserAgent(), uri.toString());
}
我正在使用这个课程
public class ExoPlayer extends ViewWrapper<EMVideoView> {
// HERE I NEED TO CALL getRendererBuilder and pass the parameters
EMVideoView.setVideoURI(Uri, getRendererBuilder(renderType, uri, defaultMediaType));
}
如何从我的班级调用私函数getRendererBuilder? 我是初学者,需要完成包装库...所以示例代码将非常好学习。
感谢。