custom forward and rewind with slider on createVideoPlayer.

You must Login before you can answer or comment on any questions.

Hello ppl. Big thanks in advance.

I've created a custom musicplayer with createVideoPlayer and a slider to work together: Slider moves while the music plays. It does. Now I want to be able to forward and rewind with the slider. It doesn't work, I guess it is because it is a remote streaming/buffering mp3. But since the native player that comes with the videoPlayer works like that I thought I would be able to use the API and functions within it, but no.

Any suggestions? I've tried it with different setups as shown below:

slider.addEventListener('touchstart', function(e) {
slider.addEventListener('touchend', function(e) {
    videoPlayer.setInitialPlaybackTime = slider.value;// I've tried initialPlaybackTime and some other stuff aswell;

1 Answer

Accepted Answer

Near the bottom of your {sdk_version}/iphone/classes/TiMediaVideoPlayerProxy.m file add:

    movie.currentPlaybackTime=[TiUtils doubleValue:value];
We hack this into every SDK release here to allow scrubbing. Couple of notes. If the stream is an MP3, then the scrubbing is very nice. If the stream is an m3u8, you move forward or back at the time increments set by the HLS segment size.

— answered 3 years ago by Stephen Feather
answer permalink
  • I just make a clean and then it works with setCurrentPlaybacktime?

    — commented 3 years ago by Martin Andersson

  • I've tried it. At least something happens to the currentPlaybackTime.

    [INFO] Time: 101339296.875

    [INFO] Slider: 101339.296875

    And that looks quit strange, the song also restarts. :)

    videoPlayer.currentPlaybackTime = slider.value;'Time: '+videoPlayer.currentPlaybackTime);'Slider: '+slider.value);;

    — commented 3 years ago by Martin Andersson

  • This solved it of course. Thank you Stephen.

    slider.addEventListener('touchend', function(e) {

    — commented 3 years ago by Martin Andersson

  • Show 8 more comments

Your Answer

Think you can help? Login to answer this question!