admin
2021-07-20 27bd1f81221b8c8e8047118a64c2beb7bc214bbb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
package com.yeshi.video.ui;
 
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.view.animation.Transformation;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.FrameLayout;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
 
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.lcjian.library.RetainViewFragment;
import com.lcjian.library.util.common.StringUtils;
import com.qq.e.ads.cfg.VideoOption;
import com.qq.e.ads.nativ.ADSize;
import com.qq.e.ads.nativ.NativeExpressAD;
import com.qq.e.ads.nativ.NativeExpressADView;
import com.qq.e.comm.util.AdError;
import com.umeng.analytics.MobclickAgent;
import com.viewpagerindicator.TabPageIndicator;
import com.yeshi.base.entity.ad.AdPositionEnum;
import com.yeshi.base.entity.video.VideoInfo;
import com.yeshi.base.utils.BeibeiConstant;
import com.yeshi.base.utils.ad.AdUtil;
import com.yeshi.base.utils.ad.GDTConstant;
import com.yeshi.base.utils.http.BasicTextHttpResponseHandler;
import com.yeshi.video.R;
import com.yeshi.video.entity.PushEpisode;
import com.yeshi.video.ui.adapter.EpisodePagerAdapter;
import com.yeshi.video.ui.adapter.GridVideoAdapter1;
import com.yeshi.video.utils.VideoApiUtil;
 
import org.apache.http.Header;
import org.json.JSONObject;
 
import java.util.List;
 
import androidx.viewpager.widget.ViewPager;
import de.greenrobot.event.EventBus;
 
/**
 * 播放详情--选集页面
 */
public class VideoEpisodeFragment extends RetainViewFragment implements
        OnClickListener {
 
    private static VideoInfo mVideoInfo;
 
    private int mPlayingPosition;
 
    private TabPageIndicator indicator_episode;
 
    private ViewPager vp_episode;
 
    private GridView gv_video_related_video, gv_video_guess_like,
            gv_video_everybody_look;
 
    private ScrollView sv_detail;
 
    private EpisodePagerAdapter mEpisodePagerAdapter;
 
    private TextView video_score, video_year, video_type, video_actor,
            video_introduction, video_more_text;
    private ImageView video_more_image;
    private LinearLayout video_introduction_more;
    private FrameLayout fl_native_ad1, fl_native_ad2, fl_native_ad3;
    // 查看更多
    private LinearLayout ll_more;
    private ImageView iv_episode;
    private TextView tv_more;
 
    public static boolean isShowMore = false;// 是否显示更多
    public static int page_varietyshow = 0;// 综艺节目的分页
    int maxDescripLine = 2;
 
    public static VideoEpisodeFragment newInstance(VideoInfo videoInfo,
                                                   int playingPostion) {
        VideoEpisodeFragment videoEpisodeFragment = new VideoEpisodeFragment();
        Bundle args = new Bundle();
        args.putSerializable("video_info", videoInfo);
        args.putInt("playing_position", playingPostion);
        videoEpisodeFragment.setArguments(args);
        // Log.i("result","进入了VideoEpisodeFragment");
        return videoEpisodeFragment;
    }
 
    @Override
    public int getContentResource() {
        return R.layout.video_episode_fragment;
    }
 
    @Override
    public void onCreateView(View contentView, Bundle savedInstanceState) {
 
        // Toast.makeText(getActivity(), "我到VideoEpisodeFragment了",
        // Toast.LENGTH_LONG).show();
        sv_detail = (ScrollView) contentView.findViewById(R.id.sv_detail);
        // Log.i("result", "VideoEpisodeFragment被创建了");
        mVideoInfo = (VideoInfo) getArguments().getSerializable("video_info");
        mPlayingPosition = getArguments().getInt("playing_position");
        tv_more = (TextView) contentView
                .findViewById(R.id.tv_video_episode_more);
        iv_episode = (ImageView) contentView
                .findViewById(R.id.iv_video_episode_more);
        ll_more = (LinearLayout) contentView
                .findViewById(R.id.video_episode_tv_lookmore);
        ll_more.setOnClickListener(this);
        // ******简介*******
        video_score = (TextView) contentView.findViewById(R.id.video_score);
        video_year = (TextView) contentView.findViewById(R.id.video_year);
        video_type = (TextView) contentView.findViewById(R.id.video_type);
        video_actor = (TextView) contentView.findViewById(R.id.video_actor);
        video_introduction = (TextView) contentView
                .findViewById(R.id.video_introduction);
        video_introduction_more = (LinearLayout) contentView
                .findViewById(R.id.video_introduction_more);
        video_more_image = (ImageView) contentView
                .findViewById(R.id.video_more_image);
        video_more_text = (TextView) contentView
                .findViewById(R.id.video_more_text);
 
        video_introduction_more.setOnClickListener(this);
        indicator_episode = (TabPageIndicator) contentView
                .findViewById(R.id.indicator_episode);
        vp_episode = (ViewPager) contentView.findViewById(R.id.vp_episode);
 
        gv_video_related_video = (GridView) contentView
                .findViewById(R.id.gv_video_related_video);
 
        fl_native_ad1 = (FrameLayout) contentView
                .findViewById(R.id.fl_native_ad_1);
 
        gv_video_guess_like = (GridView) contentView
                .findViewById(R.id.gv_video_guess_like);
 
        fl_native_ad2 = (FrameLayout) contentView
                .findViewById(R.id.fl_native_ad_2);
 
        gv_video_everybody_look = (GridView) contentView
                .findViewById(R.id.gv_video_everybody_look);
 
        fl_native_ad3 = (FrameLayout) contentView
                .findViewById(R.id.fl_native_ad_3);
 
        contentView.findViewById(R.id.ll_container).setFocusable(true);
        contentView.findViewById(R.id.ll_container).setFocusableInTouchMode(
                true);
 
        gv_video_related_video
                .setOnItemClickListener(new OnItemClickListener() {
 
                    @Override
                    public void onItemClick(AdapterView<?> parent, View view,
                                            int position, long id) {
                        VideoDetailActivity.ChangeVideoEvent changeVideoEvent_related = new VideoDetailActivity.ChangeVideoEvent();
                        changeVideoEvent_related
                                .setVideoInfo((VideoInfo) parent
                                        .getItemAtPosition(position));
                        changeVideoEvent_related.setTag("VideoPlayerFragment");
                        EventBus.getDefault().post(changeVideoEvent_related);
                    }
                });
 
        gv_video_guess_like.setOnItemClickListener(new OnItemClickListener() {
 
            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                                    int position, long id) {
                // if (position == mVideoInfos.size() - 1) {
                // mList.get(0).onAdClicked();
                // } else {
                VideoDetailActivity.ChangeVideoEvent changeVideoEvent = new VideoDetailActivity.ChangeVideoEvent();
                changeVideoEvent.setVideoInfo((VideoInfo) parent
                        .getItemAtPosition(position));
                changeVideoEvent.setTag("VideoPlayerFragment");
                EventBus.getDefault().post(changeVideoEvent);
                // }
            }
        });
 
        gv_video_everybody_look
                .setOnItemClickListener(new OnItemClickListener() {
 
                    @Override
                    public void onItemClick(AdapterView<?> parent, View view,
                                            int position, long id) {
                        VideoDetailActivity.ChangeVideoEvent changeVideoEvent_look = new VideoDetailActivity.ChangeVideoEvent();
                        changeVideoEvent_look.setVideoInfo((VideoInfo) parent
                                .getItemAtPosition(position));
                        changeVideoEvent_look.setTag("VideoPlayerFragment");
                        EventBus.getDefault().post(changeVideoEvent_look);
                    }
                });
 
        if (mVideoInfo.getShowType() == 1) {// 综艺
            indicator_episode.setVisibility(View.GONE);
            if (mVideoInfo.getVideoDetailList().size() <= 2) {
                ll_more.setVisibility(View.GONE);
            } else {
                ll_more.setVisibility(View.VISIBLE);
            }
        } else if (mVideoInfo.getShowType() == 2) {// 电视剧什么的
            if (mVideoInfo.getVideoDetailList().size() <= 10) {
                ll_more.setVisibility(View.GONE);
            } else {
                ll_more.setVisibility(View.VISIBLE);
            }
        }
        mEpisodePagerAdapter = new EpisodePagerAdapter(
                getChildFragmentManager(), mVideoInfo, mPlayingPosition);
        //
        vp_episode.setAdapter(mEpisodePagerAdapter);
        indicator_episode.setViewPager(vp_episode);
        // 指示当前播放页---hxh
 
        vp_episode.post(new Runnable() {
 
            @Override
            public void run() {
                int page = (mPlayingPosition + 1) % 20 == 0 ? (mPlayingPosition + 1) / 20
                        : (mPlayingPosition + 1) / 20 + 1;
                if (page < 1)
                    return;
                vp_episode.setCurrentItem(page - 1);
                try {
                    mEpisodePagerAdapter.notifyDataSetChanged();
                } catch (Exception e) {
 
                }
            }
        });
        gv_video_related_video.postDelayed(new Runnable() {
 
            @Override
            public void run() {
                getRelativeVideos();
                guessLike();
                getPeopleSeeVideos();
            }
        }, 1000);
 
        video_introduction.setHeight(video_introduction.getLineHeight()
                * maxDescripLine);
        video_introduction.post(new Runnable() {
 
            @Override
            public void run() {
                video_introduction_more.setVisibility(video_introduction
                        .getLineCount() > maxDescripLine ? View.VISIBLE
                        : View.GONE);
 
            }
        });
        if (AdUtil.getAdType(getContext(), AdPositionEnum.other) != null) {
//            loadAD1();
            loadAD();
        }
        getIntroductionInfo();
    }
 
    private void getIntroductionInfo() {
        Log.i("", "");
        video_score.setText((StringUtils.isEmpty(mVideoInfo.getArea()) ? "" : mVideoInfo
                .getArea()));
        video_year.setText("年份:" + mVideoInfo.getYear());
        if (mVideoInfo.getVideoType() != null)
            video_type
                    .setText("类型:"
                            + (StringUtils.isEmpty(mVideoInfo.getVideoType()
                            .getName()) ? "未知" : mVideoInfo
                            .getVideoType().getName()));
        video_actor.setText("主演:" + mVideoInfo.getMainActor());
        if (!StringUtils.isBlank(mVideoInfo.getIntroduction())) {
            video_introduction.setText("主要内容:" + mVideoInfo.getIntroduction());
        } else {
            video_introduction.setText("主要内容:");
        }
    }
 
    private void getRelativeVideos() {
        if (getActivity() == null)
            return;
        SharedPreferences preferences = getActivity().getSharedPreferences(
                "user", Context.MODE_PRIVATE);
        String uid = preferences.getString("uid", "");
        VideoApiUtil.getRelativeVideos(getActivity(), uid,
                mVideoInfo.getId(), new BasicTextHttpResponseHandler() {
 
                    @Override
                    public void onSuccessPerfect(int statusCode,
                                                 Header[] headers, JSONObject jsonObject)
                            throws Exception {
                        if (jsonObject.getBoolean("IsPost")) {
                            Gson gson = new GsonBuilder().setFieldNamingPolicy(
                                    FieldNamingPolicy.UPPER_CAMEL_CASE)
                                    .create();
                            List<VideoInfo> videoInfos = gson.fromJson(
                                    jsonObject.getJSONObject("Data")
                                            .getJSONArray("data").toString(),
                                    new TypeToken<List<VideoInfo>>() {
                                    }.getType());
                            gv_video_related_video
                                    .setAdapter(new GridVideoAdapter1(
                                            videoInfos, getActivity()
                                            .getApplicationContext(),
                                            false));
                            sv_detail.scrollTo(0, 0);
                        }
                    }
                });
    }
 
    private void guessLike() {
        if (getActivity() == null)
            return;
        SharedPreferences preferences = getActivity().getSharedPreferences(
                "user", Context.MODE_PRIVATE);
        String uid = preferences.getString("uid", "");
        VideoApiUtil.guessLike(getActivity(), uid, mVideoInfo.getId(),
                new BasicTextHttpResponseHandler() {
 
                    @Override
                    public void onSuccessPerfect(int statusCode,
                                                 Header[] headers, JSONObject jsonObject)
                            throws Exception {
                        if (jsonObject.getBoolean("IsPost")) {
                            Gson gson = new GsonBuilder().setFieldNamingPolicy(
                                    FieldNamingPolicy.UPPER_CAMEL_CASE)
                                    .create();
                            List<VideoInfo> videoInfos = gson.fromJson(
                                    jsonObject.getJSONObject("Data")
                                            .getJSONArray("data").toString(),
                                    new TypeToken<List<VideoInfo>>() {
                                    }.getType());
                            // 非聚效广告显示
                            gv_video_guess_like
                                    .setAdapter(new GridVideoAdapter1(
                                            videoInfos, getActivity()
                                            .getApplicationContext(),
                                            false));
                            sv_detail.scrollTo(0, 0);
                            // 聚效广告
                            // if (videoInfos.size() > 2) {
                            // videoInfos.remove(videoInfos.size() - 1);
                            // }
                            // mVideoInfos.addAll(videoInfos);
                            // mAdView.loadAds();
                        }
                    }
                });
    }
 
    private void getPeopleSeeVideos() {
        if (getActivity() == null)
            return;
        SharedPreferences preferences = getActivity().getSharedPreferences(
                "user", Context.MODE_PRIVATE);
        String uid = preferences.getString("uid", "");
        VideoApiUtil.getPeopleSeeVideos(getActivity(), uid,
                mVideoInfo.getId(), new BasicTextHttpResponseHandler() {
 
                    @Override
                    public void onSuccessPerfect(int statusCode,
                                                 Header[] headers, JSONObject jsonObject)
                            throws Exception {
                        if (jsonObject.getBoolean("IsPost")) {
                            Gson gson = new GsonBuilder().setFieldNamingPolicy(
                                    FieldNamingPolicy.UPPER_CAMEL_CASE)
                                    .create();
                            List<VideoInfo> videoInfos = gson.fromJson(
                                    jsonObject.getJSONObject("Data")
                                            .getJSONArray("data").toString(),
                                    new TypeToken<List<VideoInfo>>() {
                                    }.getType());
                            gv_video_everybody_look
                                    .setAdapter(new GridVideoAdapter1(
                                            videoInfos, getActivity()
                                            .getApplicationContext(),
                                            false));
                            sv_detail.scrollTo(0, 0);
                        }
                    }
                });
    }
 
    @Override
    public void onResume() {
        super.onResume();
        EventBus.getDefault().register(this);
        MobclickAgent.onPageStart("播放详情—选集");
    }
 
    @Override
    public void onPause() {
        super.onPause();
        EventBus.getDefault().unregister(this);
        isShowMore = false;
        page_varietyshow = 0;
        MobclickAgent.onPageEnd("播放详情—选集");
    }
 
    public void onEventMainThread(VideoInfo info) {
        // Log.i("result", "收到来源点击产生的列表EventBus-------------1,电视剧的长度为:" +
        // mVideoInfo.getVideoDetailList().size());
        int playingPosition = 0;
        if (mPlayingPosition != playingPosition) {
            mPlayingPosition = playingPosition;
        }
        mEpisodePagerAdapter = new EpisodePagerAdapter(
                getChildFragmentManager(), info, mPlayingPosition);
        //
        vp_episode.setAdapter(mEpisodePagerAdapter);
    }
 
    public void onEventMainThread(PushEpisode info) {
        // Log.i("result", "收到来源点击产生的列表EventBus-------------1,电视剧的长度为:" +
        // mVideoInfo.getVideoDetailList().size());
        if (mVideoInfo.getShowType() == 1) {// 综艺 如果是综艺的话就分页加载
            if (info.getEpisodeNum() > 10) {
                page_varietyshow = info.getEpisodeNum() / 10 + 1;
                isShowMore = true;
            }
        } else {
            if (info.getEpisodeNum() > 12) {
                isShowMore = true;
                tv_more.setText("点击收起");
                // Drawable drawable = getResources().getDrawable(
                // R.drawable.more_introduction2);
                // drawable.setBounds(0, 0, drawable.getMinimumWidth(),
                // drawable.getMinimumHeight());// 必须设置图片大小,否则不显示
                iv_episode.setImageResource(R.drawable.more_introduction2);
            }
        }
        mEpisodePagerAdapter.setPlayingPosition(info.getEpisodeNum());
        if (mVideoInfo != null && mVideoInfo.getVideoDetailList() != null
                && mVideoInfo.getVideoDetailList().size() > 12)
            EpisodeFragment.refresh();
    }
 
    boolean isExpand;
 
    @Override
    public void onClick(View v) {
        int id = v.getId();
        if (id == R.id.video_introduction_more) {
            isExpand = !isExpand;
            video_introduction.clearAnimation();
            final int deltaValue;
            final int startValue = video_introduction.getHeight();
            int durationMillis = 100;
            if (isExpand) {
                video_introduction_more.setVisibility(View.VISIBLE);
                deltaValue = video_introduction.getLineHeight()
                        * video_introduction.getLineCount() - startValue;
                RotateAnimation animation = new RotateAnimation(0, 180,
                        Animation.RELATIVE_TO_SELF, 0.5f,
                        Animation.RELATIVE_TO_SELF, 0.5f);
                animation.setDuration(durationMillis);
                animation.setFillAfter(true);
                video_more_image.startAnimation(animation);
                video_more_text.setText("点击收起");
 
            } else {
                video_introduction_more.setVisibility(View.VISIBLE);
                deltaValue = video_introduction.getLineHeight()
                        * maxDescripLine - startValue;
                RotateAnimation animation = new RotateAnimation(180, 0,
                        Animation.RELATIVE_TO_SELF, 0.5f,
                        Animation.RELATIVE_TO_SELF, 0.5f);
                animation.setDuration(durationMillis);
                animation.setFillAfter(true);
                video_more_image.startAnimation(animation);
                video_more_text.setText("查看更多");
 
            }
            Animation animation = new Animation() {
                protected void applyTransformation(float interpolatedTime,
                                                   Transformation t) {
                    video_introduction.setHeight((int) (startValue + deltaValue
                            * interpolatedTime));
                }
            };
            animation.setDuration(durationMillis);
            video_introduction.startAnimation(animation);
        } else if (id == R.id.video_episode_tv_lookmore) {// 查看更多
            if (mVideoInfo.getShowType() == 1) {// 综艺 如果是综艺的话就分页加载
                page_varietyshow++;
                isShowMore = true;
            } else {
                if (!isShowMore) {// 如果还没有点击查看更多,点击后查看更多
                    isShowMore = true;
                    tv_more.setText("点击收起");
                    // Drawable drawable = getResources().getDrawable(
                    // R.drawable.more_introduction2);
                    // drawable.setBounds(0, 0, drawable.getMinimumWidth(),
                    // drawable.getMinimumHeight());// 必须设置图片大小,否则不显示
                    iv_episode.setImageResource(R.drawable.more_introduction2);
                } else {// 如果以查看更多。点击后不查看更多
                    sv_detail.scrollTo(0, 0);// 回到顶部
                    isShowMore = false;
                    tv_more.setText("查看更多");
                    // Drawable drawable = getResources().getDrawable(
                    // R.drawable.more_introduction);
                    // drawable.setBounds(0, 0, drawable.getMinimumWidth(),
                    // drawable.getMinimumHeight());// 必须设置图片大小,否则不显示
                    // tv_more.setCompoundDrawables(null, null, drawable, null);
                    iv_episode.setImageResource(R.drawable.more_introduction);
                }
            }
            EpisodeFragment.refresh();
        }
    }
 
 
    private void loadAD() {
        if (AdUtil.getAdType(getContext(), AdPositionEnum.other) == null)
            return;
        NativeExpressAD nativeExpressAD = new NativeExpressAD(getContext(), new ADSize(ADSize.FULL_WIDTH, ADSize.AUTO_HEIGHT),
                GDTConstant.GDT_APP_ID, GDTConstant.GDT_HOME_AND_PLAY_BIG_PICTURE, new NativeExpressAD.NativeExpressADListener() {
            @Override
            public void onADLoaded(final List<NativeExpressADView> list) {
                if (list.size() > 1) {
                    list.get(1).render();
                    fl_native_ad2.removeAllViews();
                    fl_native_ad2.addView(list.get(1));
                }
 
                if (list.size() > 2) {
                    list.get(2).render();
                    fl_native_ad3.removeAllViews();
                    fl_native_ad3.addView(list.get(2));
                }
            }
 
            @Override
            public void onRenderFail(NativeExpressADView nativeExpressADView) {
 
            }
 
            @Override
            public void onRenderSuccess(NativeExpressADView nativeExpressADView) {
 
            }
 
            @Override
            public void onADExposure(NativeExpressADView nativeExpressADView) {
            }
 
            @Override
            public void onADClicked(NativeExpressADView nativeExpressADView) {
 
            }
 
            @Override
            public void onADClosed(NativeExpressADView nativeExpressADView) {
 
            }
 
            @Override
            public void onADLeftApplication(NativeExpressADView nativeExpressADView) {
 
            }
 
            @Override
            public void onADOpenOverlay(NativeExpressADView nativeExpressADView) {
 
            }
 
            @Override
            public void onADCloseOverlay(NativeExpressADView nativeExpressADView) {
 
            }
 
            @Override
            public void onNoAD(AdError adError) {
 
            }
        }); // 传入Activity
        // 注意:如果您在联盟平台上新建原生模板广告位时,选择了支持视频,那么可以进行个性化设置(可选)
        nativeExpressAD.setVideoOption(new VideoOption.Builder()
                .setAutoPlayPolicy(VideoOption.AutoPlayPolicy.WIFI) // WIFI 环境下可以自动播放视频
                .setAutoPlayMuted(true) // 自动播放时为静音
                .build()); //
        nativeExpressAD.loadAD(3);
    }
 
}