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);
46 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VideoView obj)
48 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
51 public override void Dispose()
53 if (!Window.IsInstalled())
55 DisposeQueue.Instance.Add(this);
61 if (swigCPtr.Handle != global::System.IntPtr.Zero)
66 NDalicPINVOKE.delete_VideoView(swigCPtr);
68 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
70 global::System.GC.SuppressFinalize(this);
76 /// Event arguments that passed via Finished signal
78 public class FinishedEventArgs : EventArgs
80 private VideoView _videoView;
83 /// The view for video playback and display.
85 public VideoView VideoView
99 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
100 private delegate void FinishedCallbackDelegate(IntPtr data);
101 private EventHandler<FinishedEventArgs> _videoViewFinishedEventHandler;
102 private FinishedCallbackDelegate _videoViewFinishedCallbackDelegate;
106 /// Event for Finished signal which can be used to subscribe/unsubscribe the event handler
107 /// (in the type of FinishedEventHandler-DaliEventHandler<object,FinishedEventArgs>) provided by the user.<br>
108 /// Finished signal is emitted when a video playback have finished.<br>
110 public event EventHandler<FinishedEventArgs> Finished
114 if (_videoViewFinishedEventHandler == null)
116 _videoViewFinishedCallbackDelegate = (OnFinished);
117 FinishedSignal().Connect(_videoViewFinishedCallbackDelegate);
119 _videoViewFinishedEventHandler += value;
123 _videoViewFinishedEventHandler -= value;
124 if (_videoViewFinishedEventHandler == null && FinishedSignal().Empty() == false)
126 FinishedSignal().Disconnect(_videoViewFinishedCallbackDelegate);
131 // Callback for VideoView Finished signal
132 private void OnFinished(IntPtr data)
134 FinishedEventArgs e = new FinishedEventArgs();
136 // Populate all members of "e" (FinishedEventArgs) with real data
137 e.VideoView = VideoView.GetVideoViewFromPtr(data);
139 if (_videoViewFinishedEventHandler != null)
141 //here we send all data to user event handlers
142 _videoViewFinishedEventHandler(this, e);
146 internal static VideoView GetVideoViewFromPtr(global::System.IntPtr cPtr)
148 VideoView ret = new VideoView(cPtr, false);
149 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154 internal class Property : global::System.IDisposable
156 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
157 protected bool swigCMemOwn;
159 internal Property(global::System.IntPtr cPtr, bool cMemoryOwn)
161 swigCMemOwn = cMemoryOwn;
162 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
165 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj)
167 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
172 DisposeQueue.Instance.Add(this);
175 public virtual void Dispose()
177 if (!Window.IsInstalled()) {
178 DisposeQueue.Instance.Add(this);
184 if (swigCPtr.Handle != global::System.IntPtr.Zero)
189 NDalicPINVOKE.delete_VideoView_Property(swigCPtr);
191 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
193 global::System.GC.SuppressFinalize(this);
197 internal Property() : this(NDalicPINVOKE.new_VideoView_Property(), true)
199 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
202 internal static readonly int VIDEO = NDalicPINVOKE.VideoView_Property_VIDEO_get();
203 internal static readonly int LOOPING = NDalicPINVOKE.VideoView_Property_LOOPING_get();
204 internal static readonly int MUTED = NDalicPINVOKE.VideoView_Property_MUTED_get();
205 internal static readonly int VOLUME = NDalicPINVOKE.VideoView_Property_VOLUME_get();
210 /// Creates an initialized VideoView.
212 public VideoView() : this(NDalicPINVOKE.VideoView_New__SWIG_0(), true)
214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
219 /// Creates an initialized VideoView.<br>
220 /// If the string is empty, VideoView will not display anything.<br>
222 /// <param name="url">The url of the video resource to display</param>
223 public VideoView(string url) : this(NDalicPINVOKE.VideoView_New__SWIG_1(url), true)
225 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
228 internal VideoView(VideoView videoView) : this(NDalicPINVOKE.new_VideoView__SWIG_1(VideoView.getCPtr(videoView)), true)
230 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
233 internal VideoView Assign(VideoView videoView)
235 VideoView ret = new VideoView(NDalicPINVOKE.VideoView_Assign(swigCPtr, VideoView.getCPtr(videoView)), false);
236 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
241 /// Downcasts a handle to VideoView handle.<br>
242 /// If handle points to a VideoView, the downcast produces valid handle.<br>
243 /// If not, the returned handle is left uninitialized.<br>
245 /// <param name="handle">Handle to an object</param>
246 /// <returns>Handle to a VideoView or an uninitialized handle</returns>
247 public new static VideoView DownCast(BaseHandle handle)
249 VideoView ret = new VideoView(NDalicPINVOKE.VideoView_DownCast(BaseHandle.getCPtr(handle)), true);
250 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
255 /// Starts the video playback.
259 NDalicPINVOKE.VideoView_Play(swigCPtr);
260 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
264 /// Pauses the video playback.
268 NDalicPINVOKE.VideoView_Pause(swigCPtr);
269 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
273 /// Stops the video playback.
277 NDalicPINVOKE.VideoView_Stop(swigCPtr);
278 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
282 /// Seeks forward by the specified number of milliseconds.
284 /// <param name="millisecond">The position for forward playback</param>
285 public void Forward(int millisecond)
287 NDalicPINVOKE.VideoView_Forward(swigCPtr, millisecond);
288 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
292 /// Seeks backward by the specified number of milliseconds.
294 /// <param name="millisecond">The position for backward playback</param>
295 public void Backward(int millisecond)
297 NDalicPINVOKE.VideoView_Backward(swigCPtr, millisecond);
298 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
301 internal VideoViewSignal FinishedSignal()
303 VideoViewSignal ret = new VideoViewSignal(NDalicPINVOKE.VideoView_FinishedSignal(swigCPtr), false);
304 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
308 internal enum PropertyRange
310 PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX
314 /// video file url as string type or PropertyMap.
316 public PropertyMap Video
320 PropertyMap temp = new PropertyMap();
321 GetProperty(VideoView.Property.VIDEO).Get(temp);
326 SetProperty(VideoView.Property.VIDEO, new Tizen.NUI.PropertyValue(value));
331 /// looping status, true or false.
338 GetProperty(VideoView.Property.LOOPING).Get(ref temp);
343 SetProperty(VideoView.Property.LOOPING, new Tizen.NUI.PropertyValue(value));
348 /// mute status, true or false.
355 GetProperty(VideoView.Property.MUTED).Get(ref temp);
360 SetProperty(VideoView.Property.MUTED, new Tizen.NUI.PropertyValue(value));
365 /// left and right volume scalar as float type, PropertyMap with two values ( "left" and "right" ).
367 public PropertyMap Volume
371 PropertyMap temp = new PropertyMap();
372 GetProperty(VideoView.Property.VOLUME).Get(temp);
377 SetProperty(VideoView.Property.VOLUME, new PropertyValue(value));