tidev / titanium-sdk

🚀 Native iOS and Android Apps with JavaScript
https://titaniumsdk.com/
Other
2.76k stars 1.21k forks source link

feat(android): videoPlayer speed property #14006

Closed m1ga closed 5 months ago

m1ga commented 8 months ago

New property to adjust the playback speed in a VideoPlayer.

Test

Add a video video.mp4 to the assets folder.

var vidWin = Titanium.UI.createWindow({
    title: 'Video View Demo',
    backgroundColor: '#fff'
});

var videoPlayer = Titanium.Media.createVideoPlayer({
    top: 2,
    autoplay: true,
    backgroundColor: 'blue',
    height: 300,
    width: 300,
    speed: 0.5,                 // <------------- new
    url: "./video.mp4",
    mediaControlStyle: Titanium.Media.VIDEO_CONTROL_DEFAULT,
    scalingMode: Titanium.Media.VIDEO_SCALING_RESIZE_ASPECT
});

var videoPlayer2 = Titanium.Media.createVideoPlayer({
    top: 304,
    autoplay: true,
    backgroundColor: 'blue',
    height: 300,
    width: 300,
    speed: 2,                  // <------------- new
    url: "./video.mp4",
    mediaControlStyle: Titanium.Media.VIDEO_CONTROL_DEFAULT,
    scalingMode: Titanium.Media.VIDEO_SCALING_RESIZE_ASPECT
});

vidWin.add(videoPlayer);
vidWin.add(videoPlayer2);
vidWin.open();