Native Video - specify the height

Hi,

I’m trying to use native API for video rendering in my app.  When I deploy the app in iPhone, the video is not scaling to the defined height.  

local video = native.newVideo( display.contentCenterX, 190, display.contentWidth, 480 )

video:load(“v1.mp4”, system.ResourceDirectory)

What is the best way to provide a progress bar - as we don’t get any event from native api, I’m planning to create my own algorithm using timer to provide an progress bar.  Is this a correct approach?

If video is completed, how can I replay - do I have to call load function again?

Cheers,

Siva

Hi @siva.in,

Did you look at the documentation for the Video object?

http://docs.coronalabs.com/api/type/Video/index.html

For a “progress bar”, I think you could check the “object.currentTime” on a repeating timer (perhaps every 100-200 milliseconds), compare that to “object.totalTime” and create a progress bar that shows how much of the video has played.

As for replaying the video, you can just use “object:seek( 0 )” and then “object:play()” to start it again.

Take care,

Brent

Hi Brent,

Thanks for your reply. However, I still have issue to set the height for a video. I have attached the screenshot & you can notice that the video is not scaling to the height (480 pixel).  Also noticed the video is not rotating when I turn the phone.

 

 

local video = native.newVideo( display.contentCenterX, 190, display.contentWidth, 480 )

video:load(“v1.mp4”, system.ResourceDirectory)

 

 

Cheers,

Siva

Hi Siva,

I think there may be some issue in your config.lua and/or build.settings file. Can you please post the content of those for me? Please surround the code by “lua” tags for clarity.

[lua] ... [/lua]

Thanks,

Brent

Hi @siva.in,

Did you look at the documentation for the Video object?

http://docs.coronalabs.com/api/type/Video/index.html

For a “progress bar”, I think you could check the “object.currentTime” on a repeating timer (perhaps every 100-200 milliseconds), compare that to “object.totalTime” and create a progress bar that shows how much of the video has played.

As for replaying the video, you can just use “object:seek( 0 )” and then “object:play()” to start it again.

Take care,

Brent

Hi Brent,

Thanks for your reply. However, I still have issue to set the height for a video. I have attached the screenshot & you can notice that the video is not scaling to the height (480 pixel).  Also noticed the video is not rotating when I turn the phone.

 

 

local video = native.newVideo( display.contentCenterX, 190, display.contentWidth, 480 )

video:load(“v1.mp4”, system.ResourceDirectory)

 

 

Cheers,

Siva

Hi Siva,

I think there may be some issue in your config.lua and/or build.settings file. Can you please post the content of those for me? Please surround the code by “lua” tags for clarity.

[lua] ... [/lua]

Thanks,

Brent