Video

Video

There are three patterns to play a video

youtube streaming video can be played with web view(page3 method). Other two method, Solar2D needs to load a video file and plays it while progressively downloading the video file.

The sample project is here.

The sample project properties

Create navigation is checked and the navigation panel will be displayed when the video finished on page4

by pressing Configure button, you will see

Pages


Page1 - native play video

layer and replacements > Video for videoFrame. You can choose a video URL on the Internet or the local video file to be included in your app.

Control buttons


Page2 - media play video

External code is set to playBtn on page2. No layer relacment is used.

media_playvideo.lua

local onComplete = function( event )
   print( "video session ended" )
end

local showControls = true

media.playVideo( 
    "http://kwiksher.com/tutorials/Video/kwikplanet.mp4",
	media.RemoteSource, showControls, onComplete )

if you like to play the video included in assets/videos/ folder, please use this one

local onComplete = function( event )
   print( "video session ended" )
end

local showControls = true

media.playVideo( "videos/kwikplanet.mp4", showControls, onComplete )


Page3 - Web View

Layer and Replacement to webFrame layer

Go to URL

To open browser app on device, use Go o URL in button’s interactions.


Page4 Video Completion Action

when native play video ends, let’s trigger an action which contains linear animations and show/hide navigation.

Create rocket rotation animation

staticImage Linear Animation.

Just tranparent 0% to 100% and Wait request.

Create an Action

this action will be triggered when Video is finished

Video Replacement with Action


Build for device

Build for iOS XCode simulator because corona simulator does not play native video. It needs to be built for devices.


Preview with xCode iOS Simulator

Page1

Page2

Page3

Page4

Page4 finished

P.S. Android has an issue about making native video transparent. See the forum topic below. Need to work around by resize the video frame or moving it off the screen instead of hide function.

http://kwiksher.com/forums/topic/hide-video-in-android-device/