Page 1 of 2

Problem with mobilecontrol player object

Posted: Fri Jan 15, 2021 6:27 pm
by SteveB
Hi all,

I have a problem with an app that is driving me mad. The app works fine if built with Livecode Indy 9-5, but keeps freezing in later versions. I’ve tried it in all versions of Indy, and Community, from 9-6-1 up to 9-6-2 RC2 with the same result.

The problem I’m having is with the mobileControlCreate player object. I filed a bug report about this when 9-6-1 came out, but Panos was unable to replicate the fault, so I’m hoping that some of you kind people could give it a try.

The fault appears both in the simulator and on a real device. I’ve tried it on 2 different model iMacs, and 3 different model iPads, and they all have the same fault.

To test this, create a New Stack > iPad/Tablet Landscape. Add a button and position it at location 100,50 with the following script.

on mouseUp
if "TestPlayer" is not among the lines of mobileControls() then
mobileControlCreate "player", "TestPlayer"
wait until "TestPlayer" is among the lines of mobileControls()
mobileControlSet "TestPlayer", "visible", true
mobileControlSet "TestPlayer", "showController", true
mobileControlSet "TestPlayer", "rect", "100,100,740,460"
end if
mobileControlDo "TestPlayer", "stop"
mobileControlSet "TestPlayer", "filename", "ht tps://commondata storage. google apis. com/gtv-videos-bucket/sample/BigBuckBunny. mp4" mobileControlDo "TestPlayer", "play"
end mouseUp

Note that due to forum rules the filename contains spaces which need deleting in order for the script to run.

As you can see, the first click creates a player object, and then launches the player. Subsequent clicks simply reload the video.

The fault is that at some point, maybe the first click of the button or maybe the tenth click, the simulator or iPad will lock up and stop responding to the button. If the video is playing then it continues to play, but the app will no longer respond.

If you do try this on your setup and get the same result, please post back here and maybe I can get the development team to investigate further.

Thanks
Steve

Re: Problem with mobilecontrol player object

Posted: Sat Jan 16, 2021 7:25 pm
by jacque
I didn't try it but my guess is that you need to remove the wait. It isn't necessary, and I suspect the player can't be created until it knows what properties to set, so it's waiting forever.

Re: Problem with mobilecontrol player object

Posted: Sun Jan 17, 2021 4:31 pm
by SteveB
The script runs the same with or without the wait command. The reason that I put the 'wait until' command in is that the script sometimes fails on first click, so the wait is there to prove that the player is being correctly created. I did this anticiating that someone may suggest that the reason that the script is failing is that parameters are being set before the player exists, but the player object always gets created correctly.

Having spent many hours trying to figure out where this is failing I know it is the 'set filename' command that fails, which is why the script creates the player just once on first run. Subsequent clicks on the button just stops the player, reloads the URL with the 'set filename' command, then restarts the player.

Re: Problem with mobilecontrol player object

Posted: Sun Jan 17, 2021 11:45 pm
by jacque
I'll assume that this is actually two lines, right?

Code: Select all

mobileControlSet "TestPlayer", "filename", "ht tps://commondata storage. google apis. com/gtv-videos-bucket/sample/BigBuckBunny. mp4" mobileControlDo "TestPlayer", "play"
Have you tried testing with a different online file? It may be an issue with the test file URL. That's all I can think of.

Re: Problem with mobilecontrol player object

Posted: Mon Jan 18, 2021 2:50 pm
by SteveB
jacque wrote:
Sun Jan 17, 2021 11:45 pm
I'll assume that this is actually two lines, right?

Code: Select all

mobileControlSet "TestPlayer", "filename", "ht tps://commondata storage. google apis. com/gtv-videos-bucket/sample/BigBuckBunny. mp4" mobileControlDo "TestPlayer", "play"
Have you tried testing with a different online file? It may be an issue with the test file URL. That's all I can think of.
Yes, it should be 2 lines. Not sure why it came out as one line.

Code: Select all

on mouseUp
if "TestPlayer" is not among the lines of mobileControls() then
mobileControlCreate "player", "TestPlayer"
wait until "TestPlayer" is among the lines of mobileControls()
mobileControlSet "TestPlayer", "visible", true
mobileControlSet "TestPlayer", "showController", true
mobileControlSet "TestPlayer", "rect", "100,100,740,460"
end if
mobileControlDo "TestPlayer", "stop"
mobileControlSet "TestPlayer", "filename", "ht tps://commondata storage. google apis. com/gtv-videos-bucket/sample/BigBuckBunny. mp4"
mobileControlDo "TestPlayer", "play"
end mouseUp
The 5 spaces in the URL need to be removed for the script to run.

Yes, I've tried other online files with the same result. If you Google 'mp4 test video' you will find plenty of examples that you can use.

Re: Problem with mobilecontrol player object

Posted: Fri Jan 22, 2021 4:51 pm
by SteveB
I've made a video showing the issue that I get. If you watch the video you will see the 3 faults modes that the player gets in to. You will also see that the fault is random. Sometimes the fault will appear on the first click, and sometimes after a number of clicks. The most clicks I've ever had before the fault appears is 12 clicks.

Machine is an iMac 14-2 running Catalina, Livecode 6-5-2 RC2, Xcode 12-1, but I get the same fault in High Sierra and Mojave, and with all versions of Livecode Indy or Community from 9-6-0 onwards (when Livecode changed to using AVKIT for the player). The same project built in previous versions is stable.

https://youtu. be/aWTMcQmAyCM

Take the space out of the link to view. Sorry for the low audio level!

Re: Problem with mobilecontrol player object

Posted: Fri Jan 22, 2021 7:24 pm
by jacque
I can't test right now, but there was a similar but not identical problem with the mobile player in one of my apps. The first thing you can try is to set the filename to empty before displaying or reloading the player.

Code: Select all

mobileControlSet "TestPlayer", "filename", empty
If that doesn't work, try it in the latest 9.6.2rc2 version of LC. There are some fixes there for player issues.

Re: Problem with mobilecontrol player object - confirmed bug

Posted: Mon Jan 25, 2021 1:49 pm
by SteveB
The LiveCode software team have emailed me to say that they have replicated the fault, and that this is now a confirmed bug. Hopefully it can be sorted in the next release as I'm waiting to update 2 apps in the store.

Re: Problem with mobilecontrol player object

Posted: Fri Apr 23, 2021 10:02 am
by okk
Hi Steve,
I believe I encounetred a similar issue, I posted it here:
viewtopic.php?f=10&t=35772
before I found your forum post. Could you share the link to the bug report, perhaps I can add to it if needed.

Have you tried your stack with MergAV? It seemed to work fine and I changed my app in such a way that it uses mergAV on iOS and the native mobilecontrol player for android and the player object on macosx. It is of cause moving away from the principle "one code to rule all platforms", but since it is just for a player object the changes are managable.

Best
Oliver

Re: Problem with mobilecontrol player object

Posted: Fri Apr 23, 2021 1:02 pm
by SteveB
Hi Oliver,

Yes, it's the same bug. In my original bug report I thought that it was a networking issue and reported it as such, but later realised it to be a player fault. Original bug report is here:

https://quality.livecode.com/show_bug.cgi?id=22650

Target fix is Livecode 9.6.3 so not sure how long it will be before we get there.

Yes, I did the same as you and switched to MergAV for iOS. I put it into a load/play/delete loop and it was still working after 2500 iterations compared to less than 20 for mobilecontrol player. Pity you have to write your own controller!

Best
Steve

Re: Problem with mobilecontrol player object

Posted: Fri Apr 23, 2021 4:52 pm
by okk
What a relief that it is a known bug. Thanks for creating the bug report, nice that it is on the road-map. I spent quite some hours with this, it was hard to narrow it down since it was so random. Btw. I couldnt figure out if MergAV can display a native controller for the video? Something like this:

Code: Select all

mergAVPlayerSet playerID, "controller", "true"
Best
Oliver

Re: Problem with mobilecontrol player object

Posted: Fri Apr 23, 2021 5:46 pm
by SteveB
I tried all combinations of controller as a property that I could think of without success. I took a peek inside the extension source code but couldn't find any refrence to controller so I guess it was never implemented. I built a controller using the duration and current time properties to move a graphic along a line.

I found that 'ready for display' crashes the app, and could never figure what the option 2 and 3 values for seek were.

Re: your question of hiding the player until the video starts, I did pretty much the same as you except I used a wait until command, so:

put mergAVPlayerCreateFromURL(pURL) into pPlayerPointer
mergAVPlayerSet pPlayerPointer, "visible", "false"
// show the spinner
mergAVPlayerDo pPlayerPointer, "play"
wait until mergAVPlayerGet(pPlayerPointer, "current time") > 0 with messages
// hide the spinner
mergAVPlayerSet pPlayerPointer, "visible", "true"

Best
Steve

Re: Problem with mobilecontrol player object

Posted: Mon May 03, 2021 11:48 am
by okk
Hi SteveB,

did you by any chance noticed any synch issues with the mobilecontrol player object on Android? I play my videos from a server and audio and video track are slightly out of synch on Android devices, it is not much, but noticable enough to be annyoying, perhaps 4 frames. The videos on the server are in perfect synch, and on iOS and on desktop the audio and video are playing in synch as well.

Best
Oliver

Re: Problem with mobilecontrol player object

Posted: Mon May 03, 2021 5:27 pm
by SteveB
Hi Oliver,

Yes, I noticed the same - a slight loss of sync. As you say it's just a few frames out. My videos are 25 fps MP4, and I would estimate it is 2 frames out.

Best
Steve

Re: Problem with mobilecontrol player object

Posted: Sun May 16, 2021 4:26 pm
by okk
Thanks! Do you think this would qualify for a bug-report? Best. O