1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 //------------------------------------------------------------------------------
20 // This file was automatically generated by SWIG (http://www.swig.org).
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
31 using System.Runtime.InteropServices;
32 using Tizen.NUI.BaseComponents;
35 /// VideoView is a control for video playback and display.
37 public class VideoView : View
39 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
41 internal VideoView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.VideoView_SWIGUpcast(cPtr), cMemoryOwn)
43 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
44 // By default, we do not want the position to use the anchor point
45 PositionUsesAnchorPoint = false;
48 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VideoView obj)
50 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
53 public override void Dispose()
55 if (!Window.IsInstalled())
57 DisposeQueue.Instance.Add(this);
63 if (swigCPtr.Handle != global::System.IntPtr.Zero)
68 NDalicPINVOKE.delete_VideoView(swigCPtr);
70 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
72 global::System.GC.SuppressFinalize(this);
78 /// Event arguments that passed via Finished signal
80 public class FinishedEventArgs : EventArgs
82 private VideoView _videoView;
85 /// The view for video playback and display.
87 public VideoView VideoView
101 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
102 private delegate void FinishedCallbackDelegate(IntPtr data);
103 private EventHandler<FinishedEventArgs> _videoViewFinishedEventHandler;
104 private FinishedCallbackDelegate _videoViewFinishedCallbackDelegate;
108 /// Event for Finished signal which can be used to subscribe/unsubscribe the event handler
109 /// (in the type of FinishedEventHandler-DaliEventHandler<object,FinishedEventArgs>) provided by the user.<br>
110 /// Finished signal is emitted when a video playback have finished.<br>
112 public event EventHandler<FinishedEventArgs> Finished
116 if (_videoViewFinishedEventHandler == null)
118 _videoViewFinishedCallbackDelegate = (OnFinished);
119 FinishedSignal().Connect(_videoViewFinishedCallbackDelegate);
121 _videoViewFinishedEventHandler += value;
125 _videoViewFinishedEventHandler -= value;
126 if (_videoViewFinishedEventHandler == null && FinishedSignal().Empty() == false)
128 FinishedSignal().Disconnect(_videoViewFinishedCallbackDelegate);
133 // Callback for VideoView Finished signal
134 private void OnFinished(IntPtr data)
136 FinishedEventArgs e = new FinishedEventArgs();
138 // Populate all members of "e" (FinishedEventArgs) with real data
139 e.VideoView = VideoView.GetVideoViewFromPtr(data);
141 if (_videoViewFinishedEventHandler != null)
143 //here we send all data to user event handlers
144 _videoViewFinishedEventHandler(this, e);
148 internal static VideoView GetVideoViewFromPtr(global::System.IntPtr cPtr)
150 VideoView ret = new VideoView(cPtr, false);
151 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
156 internal class Property : global::System.IDisposable
158 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
159 protected bool swigCMemOwn;
161 internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
163 swigCMemOwn = cMemoryOwn;
164 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
167 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
169 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
174 DisposeQueue.Instance.Add(this);
177 public virtual void Dispose()
179 if (!Window.IsInstalled()) {
180 DisposeQueue.Instance.Add(this);
186 if (swigCPtr.Handle != global::System.IntPtr.Zero)
191 NDalicPINVOKE.delete_VideoView_Property(swigCPtr);
193 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
195 global::System.GC.SuppressFinalize(this);
199 internal Property() : this(NDalicPINVOKE.new_VideoView_Property(), true)
201 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
204 internal static readonly int VIDEO = NDalicPINVOKE.VideoView_Property_VIDEO_get();
205 internal static readonly int LOOPING = NDalicPINVOKE.VideoView_Property_LOOPING_get();
206 internal static readonly int MUTED = NDalicPINVOKE.VideoView_Property_MUTED_get();
207 internal static readonly int VOLUME = NDalicPINVOKE.VideoView_Property_VOLUME_get();
212 /// Creates an initialized VideoView.
214 public VideoView() : this(NDalicPINVOKE.VideoView_New__SWIG_0(), true)
216 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
221 /// Creates an initialized VideoView.<br>
222 /// If the string is empty, VideoView will not display anything.<br>
224 /// <param name="url">The url of the video resource to display</param>
225 public VideoView(string url) : this(NDalicPINVOKE.VideoView_New__SWIG_1(url), true)
227 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
230 internal VideoView(VideoView videoView) : this(NDalicPINVOKE.new_VideoView__SWIG_1(VideoView.getCPtr(videoView)), true)
232 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
235 internal VideoView Assign(VideoView videoView)
237 VideoView ret = new VideoView(NDalicPINVOKE.VideoView_Assign(swigCPtr, VideoView.getCPtr(videoView)), false);
238 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
243 /// Downcasts a handle to VideoView handle.<br>
244 /// If handle points to a VideoView, the downcast produces valid handle.<br>
245 /// If not, the returned handle is left uninitialized.<br>
247 /// <param name="handle">Handle to an object</param>
248 /// <returns>Handle to a VideoView or an uninitialized handle</returns>
249 public new static VideoView DownCast(BaseHandle handle)
251 VideoView ret = new VideoView(NDalicPINVOKE.VideoView_DownCast(BaseHandle.getCPtr(handle)), true);
252 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
257 /// Starts the video playback.
261 NDalicPINVOKE.VideoView_Play(swigCPtr);
262 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
266 /// Pauses the video playback.
270 NDalicPINVOKE.VideoView_Pause(swigCPtr);
271 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
275 /// Stops the video playback.
279 NDalicPINVOKE.VideoView_Stop(swigCPtr);
280 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
284 /// Seeks forward by the specified number of milliseconds.
286 /// <param name="millisecond">The position for forward playback</param>
287 public void Forward(int millisecond)
289 NDalicPINVOKE.VideoView_Forward(swigCPtr, millisecond);
290 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
294 /// Seeks backward by the specified number of milliseconds.
296 /// <param name="millisecond">The position for backward playback</param>
297 public void Backward(int millisecond)
299 NDalicPINVOKE.VideoView_Backward(swigCPtr, millisecond);
300 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
303 internal VideoViewSignal FinishedSignal()
305 VideoViewSignal ret = new VideoViewSignal(NDalicPINVOKE.VideoView_FinishedSignal(swigCPtr), false);
306 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
310 internal enum PropertyRange
312 PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX
316 /// video file url as string type or PropertyMap.
318 public PropertyMap Video
322 PropertyMap temp = new PropertyMap();
323 GetProperty(VideoView.Property.VIDEO).Get(temp);
328 SetProperty(VideoView.Property.VIDEO, new Tizen.NUI.PropertyValue(value));
333 /// looping status, true or false.
340 GetProperty(VideoView.Property.LOOPING).Get(ref temp);
345 SetProperty(VideoView.Property.LOOPING, new Tizen.NUI.PropertyValue(value));
350 /// mute status, true or false.
357 GetProperty(VideoView.Property.MUTED).Get(ref temp);
362 SetProperty(VideoView.Property.MUTED, new Tizen.NUI.PropertyValue(value));
367 /// left and right volume scalar as float type, PropertyMap with two values ( "left" and "right" ).
369 public PropertyMap Volume
373 PropertyMap temp = new PropertyMap();
374 GetProperty(VideoView.Property.VOLUME).Get(temp);
379 SetProperty(VideoView.Property.VOLUME, new PropertyValue(value));