ngCordova media plugin seekTo doesn't work the first time - ionic-framework

I'm playing an audio through the ngCordova media plugin using the seekTo method:
media.play();
media.seekTo(time);
In iOS, the audio plays from the beginning instead of moving the position within the audio file while the first time playing. It only works if I delay the seekTo:
media.play();
setTimeout(function () {
media.seekTo(time);
}, 500);
However, this is not reliable and I want to check by Media.MEDIA_RUNNING status instead, which seems this callback is missing in ngCordova.

Probably you are entering time into seconds.
Try
media.seekTo(time * 1000);

Related

Listen to video progress Flutter video Player plugin

Hi I'm using the flutter video player plugin, I have something similar like this [{phrase:"something", startAt: 1039}, {phrase:"other something", startAt: 26500}] is there a way to change in ui the phrase based on the start time while the video is playing.
I have try to use a timer with a duration of 100 ms and use a player controller reference playerController.value.position.inMilliseconds and find if a phrase start at this time to scroll to this but it didn't work.
How I can't do that?
I tested the video plugin and I suggest you do the time comparison in seconds instead of milliseconds.
If you add a listener to your video plugin, unfortunately it won´t listen to it every millisecond, but it won´t fail the seconds count

How to stop video player on samsung Smart TV App without to show the black screen

Hi I'm developing Samsung app with SDK and emulator 4.5. I have a issue..The App shows by videoPlayer some videos loaded on server. My issue is: when the video play and I push button STOP, the video stops and the screen becomes black..I'd like to show the screen with the first frame of the video.
I have tried to do:
sf.service.VideoPlayer.setKeyHandler(tvKey.KEY_STOP, function()
{
if(Popup.getPopup()==Popup.getNPOPUP() && Similars.getOpenS()==false){
//videoPlayer.enterVideo(videoPlayer.url,videoPlayer.title,videoPlayer.from,videoPlayer.axoid,videoPlayer.nid); //riparte l'esecuzione del video
sf.service.VideoPlayer.stop();
videoPlayer.play();//insert function play
sf.service.VideoPlayer.pause();// stop video
videoPlayer.setFullScreen();
sf.service.VideoPlayer.show();
sf.service.VideoPlayer.pause();//stefa
}
});
I have inserted:
videoPlayer.play();//insert function play
sf.service.VideoPlayer.pause();// stop video
The play works but the pausa command not work
How can I do? Have you got a solution?
Thanks
I have inserted below
sf.service.VideoPlayer.stop();
setTimeout(function(){sf.service.VideoPlayer.pause();},2000); //delay function called of 2000 millisecond
I resolved my issue.
if delay time is not enough, you can increase the time to get the finish request.

How to set start and end time parameters using Vimeo player?

For Youtube player I can set start and end time parameters which will crop video in this range. How can I do the same thing using Vimeo player?
Vimeo JavaScript API: seekTo(seconds:Number):void and pause():void after some progress.
Vimeo ActionScript API:
seek(seconds:Number):void and pause():void after some progress.
Also basic link parameter from this Help Center article: vimeo.com/148198462#t=1m5s Stopping the video at the particular time in this case isn't implemented yet.
I was able to solve it using "setCurrentTime" for set the start of the video, and 'timeupdate' for set the end.
For the start of the video at a specific time:
Player.setCurrentTime(5);
The video will start after 5 seconds.
For the end of video:
video01Player.on('timeupdate', function(data) {
if (data.seconds > '10') {
video01Player.pause();
}
});
In this case the video will pause after 10 seconds.
timeupdate
This event fires when the playback position of the video changes, generally every 250 ms during playback, but the interval can vary depending on the browser.

iphone html 5 video - how to start from different time

What is the correct way to begin playback of a video from a specific time?
Currently, the approach we use is to check at an interval whether it's possible to seek via currentTime and then seek. The problem with this is, when the video fullscreen view pops up, it begins playback from the beginning for up to a second before seeking.
I've tried events such as onloadmetadata and canplay, but those seem to happen too early.
Added information:
It seems the very best I can do is to set a timer that tries to set currentTime repeatedly as soon as play() is called, however, this is not immediate enough. The video loads from the beginning, and after about a second, depending on the device, jumps. This is a problem for me as it provides an unsatisfactory experience to the user.
It seems like there can be no solution which does better, but I'm trying to see if there is either:
a) something clever/undocumented which I have missed which allows you to either seek before loading or otherwise indicate that the video needs to start not from 00:00 but from an arbitrary point
b) something clever which allows you to hide the video while it's playing and not display it until it has seeked (So you would see a longer delay on the phone before the fullscreen video window pops up, but it would start immediately where I need it to instead of seeking)
do something like this;
var video = document.getElementsById("video");
video.currentTime = starttimeoffset;
more Information can be found on this page dedicated to video time offset howtos
For desktop browser Chrome/Safari, you can append #t=starttimeoffsetinseconds to your video src url to make it start from certain position.
For iOS device, the best we can do is to listen for the timeupdated event, and do the seek in there. I guess this is the same as your original approach of using a timer.
-R

Playing multiple vibrates on iPhone

How can I play two or three vibrates in a row? Or different patterns of vibrate?
Repeating AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) does not work. Only does a single vibrate.
Tried using callback
OSStatus AudioServicesAddSystemSoundCompletion (
SystemSoundID kSystemSoundID_Vibrate,
CFRunLoopRef inRunLoop,
CFStringRef inRunLoopMode,
AudioServicesSystemSoundCompletionProc vibrationDone,
void *inClientData
);
but it does not trigger vibrationDone.
Try registering a callback using AudioServicesAddSystemSoundCompletion to be notified when the vibrate "sound" has ended before attempting to play it another time. From the docs:
Because a system sound may play for several seconds, you might want to know when it has finished playing. For example, you may want to wait until a system sound has finished playing before you play another sound.
NB: I haven't tried if this actually works.