black video player

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

black video player

Post by jim1001 » Fri Apr 21, 2017 7:45 pm

Tearing my hair out on this one. Probably blindingly obvious to a fresh pair of eyes but mine are raw red at the mo!

I have a LiveCode stack that plays a video just fine along with doing some other things. I extracted the code that plays the video exactly and put it into a new stack in order to do some testing on playing videos. All I get in the test stack is a black rectangle where the player should be. No sound, no change when cliched / tapped / swiped. Nothing happens if I leave the app via the home button then return as in a previous post mobileControlSet. I only have one player object. I'm using the same video as the one that works and have changed the Standalone settings to pick it up (however even if the video isn't getting picked up would I not see the player controls?)

Here is the code:

Code: Select all

local sPlayerID

on opencard
    // Check the control doesn't already exist. If so delete and recreate it
  if sPlayerID is among the lines of mobileControls() then
     mobileControlDelete sPlayerID
  end if  
   mobileControlCreate "player"
   put the result into sPlayerID
   mobileControlSet sPlayerID, "rect", "25,92,669,472" --left,top,right,bottom
   mobileControlSet sPlayerID, "visible", true
   mobileControlSet sPlayerID, "showController", true
   mobileControlSet sPlayerID, "filename", "Resources/WP6v1.webm"
   mobileControlSet sPlayerID, "currentTime", 0
   mobileControlDo sPlayerID, "play"
end opencard

on closeCard
   mobileControlDelete sPlayerID
end closeCard

Any help appreciated - thanks!

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: black video player

Post by jim1001 » Fri Apr 21, 2017 10:20 pm

Just to add I’ve been using LiveCode 8.1.3 but have also tried 7.1.4 and got same results. I’ve been targeting a minimum Android version of 4.0. The strange thing remains however is that what seems like the same code works in one stack but not in another. There must be something different but I can’t see it at the moment. If I knew what would make the player appear as a solid black rectangle that would be a big clue...

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

Re: black video player

Post by Klaus » Sat Apr 22, 2017 7:19 am

Hi Jim,

maybe a pathname problem? Quick guess, try this:

Code: Select all

...
mobileControlSet sPlayerID, "filename", (specialfolderpath("resources") & "/WP6v1.webm")
...
Best

Klaus

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: black video player

Post by jim1001 » Sat Apr 22, 2017 6:53 pm

Thank you Klaus! I got it to work by a combination of changing file location and path name as you suggested. I was convinced it wasn't anything to do with that for a number of reasons but that's why it's good to have people like you around on the forums. There are a number of things that puzzle me about this episode but I will go away, test them properly and report back.

Best wishes,
Jim

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: black video player

Post by jim1001 » Fri Apr 28, 2017 5:22 pm

To update on this one. In the original stack I had set the defaultFolder which was why my path Resources/WP6v1.webm picked up the video where I expected. I'd omitted to set the defaultFolder in the second test stack.

What threw me was that an invalid path to a video file (or none at all) could make the whole player visible only as a featureless black rectangle. I would expect (hope) that the player controls would all be shown with maybe a black image or even a helpful message where the video would normally appear. Since it was all black I thought the problem was something to do with the other code that set up the player.

Maybe there is nothing LiveCode can do about this and it's an Android issue. If that's the case it would be helpful to have this noted in the LiveCode documentation

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

Re: black video player

Post by Klaus » Fri Apr 28, 2017 6:53 pm

jim1001 wrote:To update on this one. In the original stack I had set the defaultFolder which was why my path Resources/WP6v1.webm
picked up the video where I expected. I'd omitted to set the defaultFolder in the second test stack.
One of the reasons why I never ever "set the folder to..." to access files or anything!
Whenever I can create an absolute path, and I always can, I will do so. :D

Post Reply

Return to “Android Deployment”