1

I have a little problem on IOS native send data to Html5.

Here's code from IOS

 // NSString *script = @"document.getElementById('videoID').pause()";
 NSString *script = @"document.getElementById('videoID').onpause=function()";
 [subView stringByEvaluatingJavaScriptFromString:script]; //I need to send pause data to html5 is possible if I use like this.

and

<video id="videoID" src="Kaberos.mp4" poster="poster_1.png" controls  ></video>

How can i pause video with IOS, It's possible?, if I got something wrong please let me know. Thanks.

Kind Regards,

Kabitis.

2 Answers 2

2

oh I'm wrong, now I can fix it

I try this.

[[self.scrollView.subviews objectAtIndex:currentPage-1]stringByEvaluatingJavaScriptFromString:@"document.getElementById('videoID').pause();"];

and If you want to reload page - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { you can use like this

 [[self.scrollView.subviews objectAtIndex:currentPage-1]stringByEvaluatingJavaScriptFromString:@"location.reload();"]; // reload old page

Thanks.

Kind Regards,

Kabitis.

1

Not sure I understand the question. If you're looking to pause the video then you should use the .pause() method on the video, as you've commented out in the question. If that doesn't work, then try adding that to an click event listener.

Or, if you're trying execute code when the video is paused, try using event listeners to listen for the pause event:

document.getElementById('videoID').addEventListener('pause', pauseEventHandler);

You would put your handling code in the pauseEventHandler function.

I've not coded for iOS before, but you might want to try adding an event listener to see if that works.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.