Problem with video player / APK (Android - Version 10)

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Foni
Posts: 3
Joined: Tue May 18, 2021 8:42 am

Problem with video player / APK (Android - Version 10)

Post by Foni » Tue May 18, 2021 8:56 am

Hi,

can you help me with the following problem: It's an APK (Android). On a Samsung tablet (Version 10), the video player does not work properly. The app starts with an "intro" (mp4 file) -> look for example.
In the app, the player is often used. Sometimes the player runs and sometimes the app crashes. The problem with the player only occurs with version 10. Up to version 9, the app runs perfectly.

If the player plays the file, it may or may not work. I cannot limit the problem.

For example: Here is a code from my app:

Code: Select all

global videopfad,mobil,klangpfad

on preOpenStack
   set the fullscreenmode of me to "noBorder"
end preOpenStack

on videopfadSetzen
   put 0 into mobil
   if the environment is "mobile" then
      put specialFolderPath("engine") into programmPfad
      put 1 into mobil
   else
      put the filename of this stack into programmPfad
      set the itemDelimiter to "/"
      delete the last item of programmPfad
   end if
   put programmPfad&"/hit/" into videopfad
   if the platform is "MacOS" and the environment is "standalone application" then
      set the itemDelimiter to "/"
      put the filename of this stack into programmPfad
      put item 1 to -3 of programmPfad into videoPfad
      put "/Resources/_MacOS/hit/" after videoPfad
   end if
end videopfadSetzen

on klangpfadSetzen
   if the environment is "mobile" then
      put specialFolderPath("engine") into programmPfad
   else
      put the filename of this stack into programmPfad
      set the itemDelimiter to "/"
      delete the last item of programmPfad
   end if
   put programmPfad&"/klang/" into klangpfad
   if the platform is "MacOS" and the environment is "standalone application" then
      set the itemDelimiter to "/"
      put the filename of this stack into programmPfad
      put item 1 to -3 of programmPfad into klangPfad
      put "/Resources/_MacOS/klang/" after klangPfad
   end if
end klangpfadSetzen

on introSpielenmobil
   put random(3) into x
   put random(3) into x
   put "maschaStartClip"&x into los
   put videopfad&los&".mp4" into videodatei
   play video videodatei
end introSpielenmobil

on introSpielen
   put random(3) into x
   put "maschaStartClip"&x into los
   set the fileName of player "intro" to videopfad&los&".mp4"
   start player "intro"
end introSpielen

on openStack
   global videopfad,mobil
   videopfadSetzen
   if mobil = 1 then
      introSpielenmobil
   else
      introSpielen
   end if
end openStack

Thank you very much.

Best regards,
Foni

Klaus
Posts: 13823
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Problem with video player / APK (Android - Version 10)

Post by Klaus » Tue May 18, 2021 12:07 pm

Hi Foni,

ouch, way too complicatzed! :D

No need to mess with ENGINE or any other folder of the need to modify a pathname!
Please get used to use -> specialfolderpath("resources")

Everything we add to our standalone via the "Copy files" tab in the "Standalone Application settings"
we will find in the runtime on ANY platform here -> specialfolderpath("resources")
This specialfolderpath will even work in the IDE and will point to the folder with the current stack!

So your scripts can be a LOT shorter:

Code: Select all

global videopfad,mobil,klangpfad

on preOpenStack
   set the fullscreenmode of me to "noBorder"
end preOpenStack

on videopfadSetzen
   put specialFolderPath("resources") & "/hit/" into videopfad
end videopfadSetzen

on klangpfadSetzen
   put specialFolderPath("resources") & "/klang/" into klangpfad
end klangpfadSetzen

on introSpielen
   put random(3) into x
   put videopfad & "maschaStartClip" & x & ".mp4" into videodatei
   
   ## We are on the DESKTOP
   if the environment <> "mobile" then
      set the fileName of player "intro" to videodatei
      start player "intro"
   else
      
      ## Mobile
      play video videodatei
   end if
end introSpielen

on openStack
   global videopfad,mobil
   videopfadSetzen
   ## And this, too :-)
   klangpfadSetzen
   introSpielen
end openStack
Best

Klaus

Foni
Posts: 3
Joined: Tue May 18, 2021 8:42 am

Re: Problem with video player / APK (Android - Version 10)

Post by Foni » Tue May 18, 2021 12:23 pm

Hi Klaus,

thank you very much. Thats very good. I try it.

Best regards,
Foni

Klaus
Posts: 13823
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Problem with video player / APK (Android - Version 10)

Post by Klaus » Tue May 18, 2021 12:31 pm

Hint:
Don't forget that iOs and ANDROID are case-sensitive OS, means -> video.mp4 <> Video.mp4!

Foni
Posts: 3
Joined: Tue May 18, 2021 8:42 am

Re: Problem with video player / APK (Android - Version 10)

Post by Foni » Wed May 19, 2021 10:29 am

Hi Klaus,

I tried your code. The app is now running more stable. Thank you very much :-)

When the app opens, you should actually start a welcome video. This is the "intro" - on openStack ... Unfortunately, this does not work stable. Sometimes it works, sometimes it doesn't. Depends on how quickly I reopen the app.

I think this is related to the operating system (memory, buffer). I have now solved this problem with the "intro" welcome video differently. I design it with a button. The "intro" is triggered on mouseUp. It is ok.

Best regards,
Foni

Post Reply

Return to “Multimedia”