[Resolved] media.playVideo

4 replies [Last post]
mathtoons
User offline. Last seen 1 week 5 days ago. Offline
Joined: 8 Sep 2011

Hi all,

I'm trying to have an image transition into a video. The image is a button and looks exactly like the first frame of the video. The idea is that the image is shown, then when pressed, the image disappears and the video starts. The problem I'm having is that there is a black flash between the image disappearing and the video playing. Has anyone done something like this and get it to work? Thanks in advance.

Jay

Replies

peach pellen
User offline. Last seen 1 year 37 weeks ago. Offline
Alumni
Joined: 12 Apr 2011

Hey Jay,

I believe when starting a video there will always be that moment before it starts with a little flash; that said I know someone who is currently doing a fair bit with videos and will have a word with them about their experiences and get back to you if I can find out anything relevant/helpful to your situation.

Peach :)

mathtoons
User offline. Last seen 1 week 5 days ago. Offline
Joined: 8 Sep 2011

Thanks Peach. Also trying to move seamlessly between video clips in a similar way. For example, the end of one clip is exactly the frame where a new one starts.

Joanne
User offline. Last seen 37 weeks 2 days ago. Offline
Joined: 14 Apr 2011

Can you please help me with my code....lol...it works but you have to hold your finger on the button for 2 seconds for the video to start working....

local button = display.newImage("images/proc.png")
button.x = display.contentWidth/2
button.y = 650
button.myName = "Media"
localGroup:insert(button)

local function onVideoComplete(event)

print("Video playback completed")

return 0
end

local function buttonHandler(event)
local target = event.target

if target.myName == "Media" then
media.playVideo( "images/one.m4v", true, onVideoComplete)

end

return true
end

button:addEventListener("touch", buttonHandler)
return localGroup
end

Joanne
User offline. Last seen 37 weeks 2 days ago. Offline
Joined: 14 Apr 2011

OK, false alarm. Just changed it from touch to tap. DUH. CRAFT moment.

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.