2

i created an app for my girlfriend, there is a page that she need to answer some question and then when she put the right things it move to another page that there is a video. i want to make option to rotate the video to full screen and i dont know how. i searched a lot and dont found nothing. so... this is my code:


package com.example.happybirthday;

import androidx.appcompat.app.AppCompatActivity;

import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.widget.Button;
import android.widget.MediaController;
import android.widget.VideoView;

import java.net.URL;

public class afterBirthday extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_after_birthday);
        VideoView videoView = (VideoView) findViewById(R.id.videoView);
        Uri uri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.maor12);
        videoView.setVideoURI(uri);
        MediaController mediaC = new MediaController(this);
        mediaC.setAnchorView(videoView);
        videoView.setZOrderOnTop(false);
        videoView.setRotation(90f);
        videoView.setMediaController(mediaC);
        videoView.requestFocus();
        videoView.start();
    }
    public void onPrepared(MediaPlayer mp) {

        View placeholder = (View) findViewById(R.id.placeholder);

        placeholder.setVisibility(View.GONE);
    }


}

like you can see in this picture: in regular screen its shows like that: [1]: https://i.stack.imgur.com/oscc6.jpg "firstpuc" and this is when i rotate: [2]: https://i.stack.imgur.com/NAuuP.jpg "secondpic"

0 Answers0