Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android): videoPlayer speed property #14006

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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