viewing video in browser black screen - android

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
cusinger3
Posts: 7
Joined: Mon May 13, 2019 11:44 pm

viewing video in browser black screen - android

Post by cusinger3 » Sun Jun 23, 2019 7:12 pm

I am finding that with Livecode 9.0.4, videos are not playing in the browser. The sound plays, but the screen is black (android). I looked up prior topics and found that this was an issue in 2014.... but I thought it was resolved.

I tested videos made by me and videos made by outsiders and the video part of them don't work.

I have selected accelerator in the standalone options.

Here is the code:
-- We use this variable to store the id of the UIWebView native
-- control.
local sBrowserId
global gRCBrowser, gCard

on preOpenCard

if the environment is not "mobile" then
exit preOpenCard
end if
put sBrowserID into field "userid"
-- Create our browser control and store the id
mobileControlCreate "browser"
put the result into sBrowserId
global gRCBrowser

put gRCBrowser into field "URL"
-- Native controls start off invisible
mobileControlSet sBrowserId, "visible", "true"


-- Set up a suitable initial url
mobileControlSet sBrowserId, "url", gRCBrowser

-- Make sure everything is the right size

resizeStack
end preOpenCard

on closeCard
if the environment is not "mobile" then
exit closeCard
end if

-- Destroy the control, if we fail to do this native UIViews
-- will just accumulate
mobileControlDelete sBrowserId
end closeCard

on resizeStack
if the environment is not "mobile" then
exit resizeStack
end if

put the width of this stack into tstackwidth
put the height of this stack into tstackheight
put tstackheight*.02 into tverticalspace
put tstackwidth*.02 into thorizontalspace

if tstackheight > tstackwidth then
set the width of button "retreat" to tstackwidth*.12
set the height of button "retreat" to tstackwidth*.12
set the width of button "advance" to tstackwidth*.12
set the height of button "advance" to tstackwidth*.12
set the width of button "stop" to tstackwidth*.12
set the height of button "stop" to tstackwidth*.12
set the width of button "reload" to tstackwidth*.12
set the height of button "reload" to tstackwidth*.12
set the height of field "url" to tstackwidth*.12
set the width of field "url" to tstackwidth*.25
set the width of button "print" to tstackwidth*.20
set the height of button "print" to tstackwidth*.12

else
set the width of button "retreat" to tstackheight*.12
set the height of button "retreat" to tstackheight*.12
set the width of button "advance" to tstackheight*.12
set the height of button "advance" to tstackheight*.12
set the width of button "stop" to tstackheight*.12
set the height of button "stop" to tstackheight*.12
set the width of button "reload" to tstackheight*.12
set the height of button "reload" to tstackheight*.12
set the height of field "url" to tstackheight*.12
set the width of field "url" to tstackheight*.25
set the width of button "print" to tstackheight*.20
set the height of button "print" to tstackheight*.12
end if
set the top of button "retreat" to 0
set the top of button "advance" to 0
set the top of button "stop" to 0
set the top of button "reload" to 0
set the top of field "url" to 0
set the top of button "print" to 0
set the left of button "retreat" to 0
set the left of button "advance" to the right of button "retreat"
set the left of button "stop" to the right of button "advance"
set the left of button "reload" to the right of button "stop"
set the left of button "print" to the right of button "reload"

set the left of field "url" to the right of button "print"



-- Adjust the size of the URL entry field
//set the rect of field "URL" to the left of field "URL", the top of field "URL", the width of this card - 4, the bottom of field "URL"

-- Adjust the size of the browser view
set the rect of group "Browser" to the left of group "Browser", the bottom of button "print", the width of this card - 4, the height of this card - 40

-- Adjust the status field
set the rect of field "Status" to 4, the bottom of group "Browser" + 4, the width of this card - 4, the height of this card - 4

-- Now adjust the control itself
mobileControlSet sBrowserId, "rect", the rect of group "Browser"

end resizeStack

--------

-- This message is received after a request has been allowed and
-- loading is starting
on browserStartedLoading pUrl
put "Started loading:" && pUrl into field "Status"
end browserStartedLoading

-- This message is received when a page has been completely
-- loaded and is displayed to the user
on browserFinishedLoading pUrl
put "Finished loading:" && pUrl into field "Status"
put pUrl into field "Url"
end browserFinishedLoading

-- This message is received when a new url is requested. Passing it
-- causes the load to go ahead, otherwise it does not.
on browserLoadRequest pUrl, pReason
answer "Do you want to load:" && pUrl with "Yes" and "No"
if it is "Yes" then
pass browserLoadRequest
else
put "Refused:" && pUrl into field "Status"
end if
end browserLoadRequest

--------

-- This handler is invoked by our Back/Forward/Stop/Refresh buttons
-- we just pass the request onto the control.
command doAction pAction
if the environment is not "mobile" then
exit doAction
end if

mobileControlDo sBrowserId, pAction
end doAction

-- This handler is invoked when the url field is closed after editing.
-- It causes a new url to be requested
command goUrl pUrl
if the environment is not "mobile" then
exit goUrl
end if

mobileControlSet sBrowserId, "url", pUrl
end goUrl
I am using any YouTube video

Everything works, except the image of the video.

Is this still a bug?

Thanks

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: viewing video in browser black screen - android

Post by sphere » Mon Jun 24, 2019 11:16 am

Do you use the browser widget?

set URL of widget"browser" to "https://youtube.com/blablablablabla"

and it plays just fine, but on emulator it can be that you get a black screen with some Android images. There is a bug report made for it.

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: viewing video in browser black screen - android

Post by LiveCode_Panos » Tue Aug 02, 2022 9:34 am

Hello all,

If you want to play videos in a mobile browser control on Android you have to enable hardware acceleration in the Android standalone settings.

Cheers,
Panos
--

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: viewing video in browser black screen - android

Post by richmond62 » Tue Aug 02, 2022 10:09 am

I wonder why you are using LiveCode 9.0.4

Commercial 9.6.8: https://downloads.livecode.com/livecode/

Community 9.6.3: https://community.livecode.com/9_6_3/

Post Reply

Return to “Android Deployment”