pedroSG94 / vlc-example-streamplayer

Example code how to play a stream with VLC
GNU General Public License v3.0
227 stars 93 forks source link

缓冲值 #16

Open 596151023 opened 6 years ago

596151023 commented 6 years ago

如何设置缓冲值呢?How do I set the buffer value?

pedroSG94 commented 6 years ago

https://wiki.videolan.org/VLC_command-line_help

Use option --network-caching. Example: Replace this line: https://github.com/pedroSG94/vlc-example-streamplayer/blob/master/app/src/main/java/com/pedro/vlctestapp/MainActivity.java#L25 To:

//by default caching is 1000(ms) in linux desktop official VLC app.
private String[] options = new String[]{":fullscreen", "--network-caching=2000"};
596151023 commented 6 years ago

如果需要降低延迟到350ms,如何处理呢?(If you need to reduce the delay to 350ms, how do you handle it?)

pedroSG94 commented 6 years ago
private String[] options = new String[]{":fullscreen", "--network-caching=350"};

Remember that it will change delay of player. The delay result if you are doing an stream is: stream delay + player delay.

596151023 commented 6 years ago

This change is stream delay or playback delay, I did the above field modification delay is still about 1 second.How can the overall delay be within 350?

596151023 commented 6 years ago

How do you set hard decoding?

pedroSG94 commented 6 years ago

The reason that no work maybe is that you should write option like (I'm not sure):

":network-caching=350"

instead of:

"--network-caching=350"

For hardware decoding. You have all commands info in the link.

596151023 commented 6 years ago

Thank you very much, brother

596151023 commented 6 years ago

How to set off sound, as long as the screen?What about the SurfaceView width and height setting?(如何设置关闭声音,只要画面呢?还有那个SurfaceView宽高设置失效如何解决呢?)

pedroSG94 commented 6 years ago

You need add one function to library:

public void setVolume(int volume) {
    if (player != null && player.isPlaying()) {
      player.setVolume(volume);
      //player.setAspectRatio();
    }
  }

This function should work if you call it while reproduce(no tested). If you want change it with a finger drag you should create your own listener for it and call this function in the callback(Google it, this should be easy to find). If you change resolution use commented setActionRatio line and create your own function. The string parameter maybe work if you use aspectratio of command line link(If not find documentation of that).

596151023 commented 6 years ago

How to deal with it if you play it for a long time without moving or if you have a black screen?(播放时间久了就不动了或者黑屏了怎么处理呢?)

596151023 commented 6 years ago

屏幕关闭久了再打开也会崩溃(The screen will crash if it is turned off for a long time)