반응형

리눅스(우분투) 서버 같은 콘솔 환경에서도 비디오 플레이어를 사용할 수 있다.


mpv를 설치한다.


--vo=drm 옵션, 영상 파일 이름과 함께 실행한다.


자막 파일이 있다면 자막도 표시된다. 주요 단축키 목록은 아래와 같다.


  • LEFT and RIGHT: Seek backward/forward 5 seconds. Shift+arrow does a 1 second exact seek

  • UP and DOWN: Seek forward/backward 1 minute. Shift+arrow does a 5 second exact seek

  • p / SPACE: Pause (pressing again unpauses).

  • q: Stop playing and quit.

  • Q: Like q, but store the current playback position. Playing the same file later will resume at the old playback position if possible.

  • 9 and 0: Decrease/increase volume.

  • m: Mute sound.

  • o (also P): Show progression bar, elapsed time and total duration on the OSD.

  • O: Toggle OSD states between normal and playback time/duration.

  • v: Toggle subtitle visibility.

  • z and Z: Adjust subtitle delay by +/- 0.1 seconds. The x key does the same as Z currently, but use is discouraged.

  • r and R: Move subtitles up/down. The t key does the same as R currently, but use is discouraged.

  • s: Take a screenshot.

  • S: Take a screenshot, without subtitles. (Whether this works depends on VO driver support.)

  • Shift+PGUP and Shift+PGDWN: Seek backward or forward by 10 minutes. (This used to be mapped to PGUP/PGDWN without Shift.)

  • 1 and 2: Adjust contrast.

  • 3 and 4: Adjust brightness.

  • 5 and 6: Adjust gamma.

  • 7 and 8: Adjust saturation.


반응형
Posted by J-sean
:
반응형

You can stream a video file with VideoView.


<AndroidManifest.xml>

1
    <uses-permission android:name="android.permission.INTERNET"/>



<MainActivity.java>

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
public class MainActivity extends AppCompatActivity {
 
    VideoView videoView;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
        videoView = findViewById(R.id.videoView);
 
        MediaController mediaController = new MediaController(this);
        videoView.setMediaController(mediaController);
 
        Button button = findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                videoView.setVideoURI(Uri.parse("http://nexoft.tk/data/WhileYouWereSleeping.mp4")); // or your video file url.
                videoView.requestFocus();
                videoView.start();
            }
        });
 
        videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mp) {
                Toast.makeText(getApplicationContext(), "Video play completed", Toast.LENGTH_SHORT).show();
            }
        });
 
        videoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
            @Override
            public boolean onError(MediaPlayer mp, int what, int extra) {
                String message;
 
                switch (what) {
                    case MediaPlayer.MEDIA_ERROR_UNKNOWN:
                        message = "MEDIA_ERROR_UNKNOWN";
                        break;
 
                    case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
                        message = "MEDIA_ERROR_SERVER_DIED";
                        break;
 
                    default:
                        message = "No what";
                }
 
                switch (extra) {
                    case MediaPlayer.MEDIA_ERROR_IO:
                        message += ", MEDIA_ERROR_IO";
                        break;
 
                    case MediaPlayer.MEDIA_ERROR_MALFORMED:
                        message += ", MEDIA_ERROR_MALFORMED";
                        break;
 
                    case MediaPlayer.MEDIA_ERROR_UNSUPPORTED:
                        message += ", MEDIA_ERROR_UNSUPPORTED";
                        break;
 
                    case MediaPlayer.MEDIA_ERROR_TIMED_OUT:
                        message += ", MEDIA_ERROR_TIMED_OUT";
                        break;
 
                    default:
                        message += ", No extra";
                }
                Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT).show();
 
                //    Returns true if the method handled the error, false if it didn't. Returning false, or not having an OnErrorListener
                //    at all, will cause the OnCompletionListener to be called.
                return true;
            }
        });
    }
}




Run the app and click the PLAY button.


It may not be able to stream the video and show an error message in AVD.


It can stream the video in the actual device.


반응형
Posted by J-sean
: