| | |
| | | */ |
| | | public class PlayVideoPreADFragment extends Fragment implements View.OnClickListener { |
| | | |
| | | private int AD_DURATION = 10; |
| | | |
| | | private final static String TAG = PlayVideoPreADFragment.class.getName(); |
| | | |
| | | private MediaView mediaView; |
| | |
| | | @Nullable |
| | | @Override |
| | | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| | | |
| | | Bundle bundle = getArguments(); |
| | | if (bundle != null) { |
| | | AD_DURATION = bundle.getInt("skipDuration", 5); |
| | | } |
| | | |
| | | View root = LayoutInflater.from(getContext()).inflate(R.layout.item_video_detail_ad, null); |
| | | initView(root); |
| | |
| | | @Override |
| | | public void onVideoStart() { |
| | | Log.d(TAG, "onVideoStart"); |
| | | if (ad.getVideoDuration() / 1000 > 5) |
| | | remainTime = 5; |
| | | if (ad.getVideoDuration() / 1000 > AD_DURATION) |
| | | remainTime = AD_DURATION; |
| | | else |
| | | remainTime = ad.getVideoDuration() / 1000; |
| | | |
| | |
| | | tv_skip.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | Log.i(TAG, "点击跳过"); |
| | | if (mGDTAdData != null) |
| | | mGDTAdData.stopVideo(); |
| | | if (videoAdListener != null) |