Creating a simple instance of ExoPlayer

前端 未结 3 1543
心在旅途
心在旅途 2020-12-29 11:48

I am currently looking to develop an application that utilises Dash through the ExoPlayer in Android.

To begin with I am going through the demo project however am ha

3条回答
  •  臣服心动
    2020-12-29 12:24

    Today while working on a project, I found that this.myExoPlayer = ExoPlayerFactory.newSimpleInstance(getActivity()); and some others are now deprecated and Android studio suggested to use new way. So I did a quick Google for it but everywhere I found the old way. So I looked into the SimpleExoPlayer.java file, read some methods. So this is how you initialize simpleExoPlayer:

      Activity activity = getActivity(); // if you are in a fragment
      // Or,   activity = YourActivity.this;      if you are in an Activity
      SimpleExoPlayer simpleExoPlayer = new SimpleExoPlayer.Builder(activity).build();
    

    I hope this is helpful.

提交回复
热议问题