add argument handling to video player

This commit is contained in:
Page Asgardius 2022-08-28 08:22:28 -07:00
parent 6c1bd9c241
commit 737296e213
2 changed files with 6 additions and 4 deletions

View file

@ -19,15 +19,15 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
//buttonaction //buttonaction
videoplayer(); videoplayer("https://video.asgardius.company/download/videos/41780585-a935-4d53-84c8-45ce97141231-480.mp4");
} }
}); });
} }
private void videoplayer() { private void videoplayer(String url) {
Intent intent = new Intent(this, VideoPlayer.class); Intent intent = new Intent(this, VideoPlayer.class);
intent.putExtra("video_url", url);
startActivity(intent); startActivity(intent);
} }

View file

@ -24,7 +24,7 @@ public class VideoPlayer extends AppCompatActivity {
// url of video which we are loading. // url of video which we are loading.
String videoURL = "https://video.asgardius.company/download/videos/41780585-a935-4d53-84c8-45ce97141231-480.mp4"; //String videoURL = "https://video.asgardius.company/download/videos/41780585-a935-4d53-84c8-45ce97141231-480.mp4";
ExoPlayer player; ExoPlayer player;
@ -32,6 +32,8 @@ public class VideoPlayer extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_player); setContentView(R.layout.activity_video_player);
//Get media url
String videoURL = getIntent().getStringExtra("video_url");
playerView = findViewById(R.id.player_view); playerView = findViewById(R.id.player_view);
// creating a variable for exoplayer // creating a variable for exoplayer
player = new ExoPlayer.Builder(this).build(); player = new ExoPlayer.Builder(this).build();