Skip to content

Commit

Permalink
feat(android): videoPlayer speed property (#14006)
Browse files Browse the repository at this point in the history
* feat(android): videoPlayer speed property

* docs
  • Loading branch information
m1ga authored Jun 15, 2024
1 parent 6552a2c commit 7b9a4e9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import android.media.MediaPlayer.OnCompletionListener;
import android.media.MediaPlayer.OnErrorListener;
import android.media.MediaPlayer.OnPreparedListener;
import android.media.PlaybackParams;
import android.net.Uri;
import android.os.Build;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
Expand Down Expand Up @@ -330,6 +332,13 @@ public void release()
@Override
public void onPrepared(MediaPlayer mp)
{

if (proxy.hasPropertyAndNotNull(TiC.PROPERTY_SPEED) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PlaybackParams myPlayBackParams = new PlaybackParams();
myPlayBackParams.setSpeed(TiConvert.toFloat(proxy.getProperty(TiC.PROPERTY_SPEED)));
mp.setPlaybackParams(myPlayBackParams);
}

getPlayerProxy().onPlaybackReady(mp.getDuration());
}

Expand Down
9 changes: 9 additions & 0 deletions apidoc/Titanium/Media/VideoPlayer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,15 @@ properties:
platforms: [iphone, ipad, macos]
type: MovieSize

- name: speed
summary: Playback speed of the video.
description: |
Playback speed of the video. Android: only available for API level >= 23.
type: Number
platforms: [android]
since: 12.4.0
availability: creation

- name: overlayView
summary: Use the overlay view to add additional custom views between the video content and the controls.
description: |
Expand Down

0 comments on commit 7b9a4e9

Please sign in to comment.