Android uses vitamio to build its own universal player (2) – gesture to control brightness, volume and zoom

preface

This chapter continues to improve the core functions of players related to playback, so as to lay a good foundation for subsequent expansion.

series

1. Android uses vitamio to build its own universal player (1) -- Preparation

text

1、 Achieve goals

1.1 brightness control

Simulate vplayer interface:

1.2 sound control

Simulate vplayer interface:

1.3 picture zooming

Stretch, cut, 100%, full screen according to the following API

2、 Introduction to vitamio API

VideoView

2.1 public void start()

Start playing

2.2 public void pause()

Pause playback

2.3 public long getDuration()

Get video duration

2.4 public long getCurrentPosition()

Gets the length of time that has been played

2.5 public void seekTo(long msec)

Set the player to play from the specified position

2.6 public boolean isPlaying()

Is it playing

2.7 public int getVideoWidth()

Get video width

2.8 public int getVideoHeight()

Get video high

2.9 public void setBufferSize(int bufSize)

Set the cache size, 1024KB by default

2.10 public void setVideoQuality(int quality)

Set the video quality, low, medium and high (mediaplayer.videoquality_low, mediaplayer.videoquality_medium, mediaplayer.videoquality_high),

Default low (smoothest).

2.11 public void setSubShown(boolean shown)

Sets whether subtitles are displayed

2.12 public void setAudioTrack(int audioIndex)

To set the audio track, it must be the return value of getaudiotrackmap (string).

2.13 public void setVolume(float leftVolume,float rightVolume)

Set the left and right volume of stereo sound.

2.14 public void setSubPath(String subPath)

Set external subtitle path

2.15 public int getBufferPercentage()

Get buffer percentage

2.16 public void stopPlayback()

stop playing

2.17 public void setVideoPath(String path)

Set video playback path

2.18 public void setVideoURI(Uri uri)

Set video playback path

2.19 public void setVideoLayout(int layout,float aspectRatio)

Set video zoom (stretch, cut, 100%, full screen)

III. implementation code

3.1 xml

3.2 Activity

3.3 code description

3.3.1 zoom function

This function SDK has provided an interface, which can be used directly.

3.3.2 realization of volume and brightness control

It can be seen from the layout that the progress bar effect can be achieved by controlling the width of the latter view by using the characteristics of FrameLayout (the rear view will cover the front view).

3.3.3 auto hide

Handle can be used to realize the function of self-determined delay hiding, which is more practical.

3.3.4 gestures

In terms of gestures, you can check more information about gesturedetector. Double click and zoom gestures can be realized.

IV. code download

Please move #taocode (SVN): (if there is no account, please register an account.)

Project address: http://code.taobao.org/p/oplayer

V. vitamio related information

5.1 a new SDK version will be released in the near future

5.1.1 the built-in decoder of each platform will be directly installed without external download!

5.1.2 user defined progress control bars will be supported.

Vi. relevant articles

6.1 when Android plays a movie, slide the screen to adjust the screen brightness

6.2 android MediaPlayer API

end

This series of articles promises to publish at least one article a week to help friends in need integrate vitamio into their own or company projects as soon as possible.

The above is the sorting of Android vitamio materials, which will be supplemented in the future.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>