Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

iOS and MacOS / iOS Video playback Issue (no looping)

Author
Message
Dybing
13
Years of Service
User Offline
Joined: 12th Sep 2011
Location: Bergen, Norway
Posted: 24th Aug 2017 09:45 Edited at: 24th Aug 2017 10:22
I got this app that works wonderfully in Android - where users watch a video of someone doing a sign (with video volume muted) and then have to 'guess' from three alternative symbols what the sign is.

Thing is, the video have to loop - play repeatedly until user have made a choice - and then play once more, this time with sound.

On iOS (tested on a iPhone of a recent model, SE something. I don't know, it's an Apple thingie), the video will not loop.

I've used the 'map video on image' technique to be able to fade and size the videos properly - this seems to give no issue, as it fades beautifully in and out, and is positioned where it is supposed to.

The looping routine is basically checking for video-position, and 0.5 seconds before it reaches the end, reset the position to 0.00. Gist of the code follows:



Any help appreciated. I really need those videos looping

edit: hmm, could it be something so stupidly simple as on iOS it only looks at integer seconds, so if I change the looping control routine from float to integer, do the check on 1 sec before end of video, and hey presto?! Seems unlikely, as the documentation say GetVideoPosition() and GetVideoDuration() will both return a float - but the text is a bit ambiguous, as it says seconds - and also uses the term seconds in the SetVideoPosition() documentation rather than a proper type, like say integer or float.

I'll check once my colleague gets back after now running - well driving to be accurate - home to get his iPad charger so we can check on that as well

edit2: Oh, you can check out the (working) Android version by downloading and installing from this link: https://app.box.com/s/hfmh2mhfozoy6en3rayjkgo1bvwagb29

The link will be deprecated soon, as I'm working on a new version, but through the weekend at least, the app should work. It checks with backend whether or not new version is required - and if so won't start until new version is installed. Though no worries, I intend to have it made a public alpha over the weekend. Just a few more things I need cram in... And get the iOS version out the door at the same time, if only I can get the video working properly on those Apple devices.

Oh, and the (spoken) language in the sign-videos are Norwegian only ATM. This will change early next year if all goes to plan. Menus and such are already in English and Norwegian - more languages to come maybe late next year.
Dybing
13
Years of Service
User Offline
Joined: 12th Sep 2011
Location: Bergen, Norway
Posted: 24th Aug 2017 14:22 Edited at: 24th Aug 2017 14:28
Think I figured out some issues I had. First of all, iOS doesn't report back anything useful on video-position and duration, so that was a lost cause. Instead I just hacked together a solution that do actually work, and amazingly without flicker at the loop point as such a solution would entail on Android. Peek at code below to see the hack:



The ios variable I'm checking against is just a global flag right at the start of the main file. So set to true (1) if compiling for iOS, false (0) if for Android. Awful quick little hack, but as I said, it do work.

Another issue, two of my videofiles got Nordic characters in them - no not Thor, Loke, Frey or Wotan - but the more mundane æ, ø and å. Which is fine on Win10, Linux, OSX and Android - but apparantly not on iOS. So every time the app tried to send a request for those video files to the server with those characters in their name, it threw a hissy fit, promtly refused to cooperated and quit to desktop. Is it desktop on phone/tablet? Home Screen? Anyhow, had to fix that as well, but that was easy enough - quick edit of a json on the server, rename the two offending files and done.

Finally there are some caching and async timing issues with iOS when transferring over http that I have yet to figure out entirely. The app gets ahead of itself now and again, causing trouble. So far solved with a brutish delete of the temp file it saves the downloaded video to, and a sleep() command at a strategic place, but it is very ugly. I need see if I can't get it more to my liking over the weekend. In between beer, War Thunder and maybe some Kerbal Space Program. Hmmmm, Methinks Jeb is up for a trip to Minmus
Dybing
13
Years of Service
User Offline
Joined: 12th Sep 2011
Location: Bergen, Norway
Posted: 28th Aug 2017 01:42
First off, Jeb did indeed get to Minmus. Well, in orbit at least - a scientist Kerbal actually landed.

Now that the important stuff is done with - I've finally figured out (knock on wood) how to do looping video on iOS. It took a *lot* of testing, as video freezing was quite intermittent. The trick, as it were, is to call for a sync before restarting the video.



Who should I bill for the extra hours to figure this out? Apple or TGC?

Login to post a reply

Server time is: 2024-11-21 13:43:05
Your offset time is: 2024-11-21 13:43:05