This shows you the differences between two versions of the page.
built_in:videoview [2015/03/22 13:34] octazid completed |
built_in:videoview [2015/03/22 21:34] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== VideoView control ====== | ||
- | ===== Methods ===== | ||
- | Some controls use the same methods.\\ | ||
- | For examples of the **[[same methods]]** look here. | ||
- | ^Method ^Description ^ | ||
- | |VideoView.Destroy() | | | ||
- | |VideoView.GetAbsHeight() | | | ||
- | |VideoView.GetAbsWidth() | | | ||
- | |VideoView.GetDuration() | | | ||
- | |VideoView.GetHeight() | | | ||
- | |VideoView.GetPosition() | | | ||
- | |VideoView.GetType() | | | ||
- | |VideoView.GetVisibility() | | | ||
- | |VideoView.GetWidth() | | | ||
- | |VideoView.IsPlaying() | | | ||
- | |VideoView.IsReady() | | | ||
- | |VideoView.Pause() | | | ||
- | |VideoView.Play() | | | ||
- | |VideoView.Release() | | | ||
- | |VideoView.SeekTo( p1 ) | | | ||
- | |VideoView.SetBackColor( p1 ) | | | ||
- | |VideoView.SetBackGradient( p1, | ||
- | |VideoView.SetBackGradientRadial( p1, | ||
- | |VideoView.SetBackground( p1,p2 ) | | | ||
- | |VideoView.SetFile( p1 ) | | | ||
- | |VideoView.SetMargins( left, | ||
- | |VideoView.SetOnComplete( callback ) | | | ||
- | |VideoView.SetOnError( callback ) | | | ||
- | |VideoView.SetOnReady( callback ) | | | ||
- | |VideoView.SetPadding( p1,p2,p3,p4 ) | | | ||
- | |VideoView.SetPosition( p1,p2,p3,p4 ) | | | ||
- | |VideoView.SetScale( x,y ) | | | ||
- | |VideoView.SetSize( p1,p2 ) | | | ||
- | |VideoView.SetVisibility( p1 ) | | | ||
- | |VideoView.Stop() | | | ||
- | |||
- | =====Example===== | ||
- | //(Example taken from the DroidScript sample section)// | ||
- | <code javascript> | ||
- | |||
- | // | ||
- | var folder = "/ | ||
- | |||
- | // | ||
- | function OnStart() | ||
- | { | ||
- | // | ||
- | app.ShowProgress(" | ||
- | |||
- | // | ||
- | lay = app.CreateLayout( " | ||
- | |||
- | // | ||
- | player = app.CreateVideoView( 0.8, | ||
- | lay.AddChild( player ); | ||
- | player.SetOnReady( player_OnReady ); | ||
- | player.SetOnComplete( player_OnComplete ); | ||
- | |||
- | // | ||
- | spin = app.CreateSpinner( " | ||
- | spin.SetSize( 0.8, | ||
- | spin.SetOnTouch( spn_OnTouch ); | ||
- | lay.AddChild( spin ); | ||
- | |||
- | // | ||
- | btnPlay = app.CreateButton( " | ||
- | btnPlay.SetMargins( 0, | ||
- | btnPlay.SetOnTouch( btnPlay_OnTouch ); | ||
- | lay.AddChild( btnPlay ); | ||
- | |||
- | // | ||
- | btnPause = app.CreateButton( " | ||
- | btnPause.SetOnTouch( btnPause_OnTouch ); | ||
- | lay.AddChild( btnPause ); | ||
- | |||
- | // | ||
- | btnStop = app.CreateButton( " | ||
- | btnStop.SetOnTouch( btnStop_OnTouch ); | ||
- | lay.AddChild( btnStop ); | ||
- | |||
- | // | ||
- | skb = app.CreateSeekBar( 0.8, | ||
- | skb.SetMargins( 0, | ||
- | skb.SetRange( 1.0 ); | ||
- | skb.SetOnTouch( skb_OnTouch ); | ||
- | lay.AddChild( skb ); | ||
- | |||
- | // | ||
- | app.AddLayout( lay ); | ||
- | |||
- | // | ||
- | mp4List = app.ListFolder( folder, | ||
- | spin.SetList( mp4List ); | ||
- | app.HideProgress(); | ||
- | |||
- | // | ||
- | player.SetFile( folder + "/" | ||
- | dur = null; | ||
- | |||
- | // | ||
- | setInterval( " | ||
- | } | ||
- | |||
- | // | ||
- | function player_OnReady() | ||
- | { | ||
- | player.Play(); | ||
- | } | ||
- | |||
- | // | ||
- | function player_OnComplete() | ||
- | { | ||
- | app.ShowPopup( " | ||
- | } | ||
- | |||
- | // | ||
- | function spn_OnTouch( item ) | ||
- | { | ||
- | player.SetFile( folder + "/" | ||
- | } | ||
- | |||
- | // | ||
- | function btnPlay_OnTouch() | ||
- | { | ||
- | player.Play(); | ||
- | } | ||
- | |||
- | // | ||
- | function btnPause_OnTouch() | ||
- | { | ||
- | player.Pause(); | ||
- | } | ||
- | |||
- | // | ||
- | function btnStop_OnTouch() | ||
- | { | ||
- | player.Stop(); | ||
- | } | ||
- | |||
- | // | ||
- | function skb_OnTouch( value ) | ||
- | { | ||
- | player.SeekTo( dur * value ); | ||
- | } | ||
- | |||
- | // | ||
- | function Update() | ||
- | { | ||
- | dur = player.GetDuration(); | ||
- | prog = player.GetPosition(); | ||
- | if( dur ) skb.SetValue( prog / | ||
- | } | ||
- | </ |