我正在使用EasyVideoLibrary因为我有多台摄像头要监控。这里的问题是我无法流式传输其中包含标头/身份验证令牌的视频。 例如:rtsp:// admin:admin@/192.0.0.0:500/12
我无法流式传输上述链接,因为EasyVideoLibrary没有提供传递标题和网址的方法。 有没有办法自定义库?期待解决方案.Below是我的适配器代码。
public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.VewHolder>
implements EasyVideoCallback, EasyVideoProgressCallback {
Context mContext;
List<String> cameraList;
public VideoAdapter(Context mContext, List<String> cameraList) {
this.mContext = mContext;
this.cameraList = cameraList;
}
@NonNull
@Override
public VideoAdapter.VewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.camera_adapter, parent, false);
return new VewHolder(itemView);
}
@Override
public void onBindViewHolder(@NonNull VideoAdapter.VewHolder holder, int position) {
assert holder.player != null;
holder.player.setCallback(this);
holder.player.setProgressCallback(this);
holder.player.setSource(Uri.parse(cameraList.get(position)));
holder.player.setAutoPlay(true);
holder.player.setLoop(false);
holder.player.enableControls(true);
}
@Override
public int getItemCount() {
return cameraList.size();
}
@Override
public void onVideoProgressUpdate(int position, int duration) {
}
@Override
public void onStarted(EasyVideoPlayer player) {
}
@Override
public void onPaused(EasyVideoPlayer player) {
}
@Override
public void onPreparing(EasyVideoPlayer player) {
}
@Override
public void onPrepared(EasyVideoPlayer player) {
player.start();
}
@Override
public void onBuffering(int percent) {
}
@Override
public void onError(EasyVideoPlayer player, Exception e) {
}
@Override
public void onCompletion(EasyVideoPlayer player) {
player.release();
}
@Override
public void onRetry(EasyVideoPlayer player, Uri source) {
}
@Override
public void onSubmit(EasyVideoPlayer player, Uri source) {
}
@Override
public void onClickVideoFrame(EasyVideoPlayer player) {
}
public class VewHolder extends RecyclerView.ViewHolder {
EasyVideoPlayer player;
public VewHolder(View itemView) {
super(itemView);
player = itemView.findViewById(R.id.player);
}
}}