Revert "[Tizen] some APIs are changed for preview#4"
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / VideoView.cs
1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
2 *
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
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
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.
14 *
15 */
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
17 //------------------------------------------------------------------------------
18 // <auto-generated />
19 //
20 // This file was automatically generated by SWIG (http://www.swig.org).
21 // Version 3.0.9
22 //
23 // Do not make changes to this file unless you know what you are doing--modify
24 // the SWIG interface file instead.
25 //------------------------------------------------------------------------------
26
27 namespace Tizen.NUI.BaseComponents
28 {
29
30     using System;
31     using System.Runtime.InteropServices;
32
33     /// <summary>
34     /// VideoView is a control for video playback and display.
35     /// </summary>
36     public class VideoView : View
37     {
38         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
39
40         internal VideoView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.VideoView_SWIGUpcast(cPtr), cMemoryOwn)
41         {
42             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
43             // By default, we do not want the position to use the anchor point
44             PositionUsesAnchorPoint = false;
45         }
46
47         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VideoView obj)
48         {
49             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
50         }
51
52         protected override void Dispose(DisposeTypes type)
53         {
54             if(disposed)
55             {
56                 return;
57             }
58
59             if(type == DisposeTypes.Explicit)
60             {
61                 //Called by User
62                 //Release your own managed resources here.
63                 //You should release all of your own disposable objects here.
64             }
65
66             //Release your own unmanaged resources here.
67             //You should not access any managed member here except static instance.
68             //because the execution order of Finalizes is non-deterministic.
69
70             if (swigCPtr.Handle != global::System.IntPtr.Zero)
71             {
72                 if (swigCMemOwn)
73                 {
74                     swigCMemOwn = false;
75                     NDalicPINVOKE.delete_VideoView(swigCPtr);
76                 }
77                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
78             }
79
80             base.Dispose(type);
81         }
82
83         /// <summary>
84         /// Event arguments that passed via Finished signal
85         /// </summary>
86         public class FinishedEventArgs : EventArgs
87         {
88             private VideoView _videoView;
89
90             /// <summary>
91             /// The view for video playback and display.
92             /// </summary>
93             public VideoView VideoView
94             {
95                 get
96                 {
97                     return _videoView;
98                 }
99                 set
100                 {
101                     _videoView = value;
102                 }
103             }
104         }
105
106
107         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
108         private delegate void FinishedCallbackDelegate(IntPtr data);
109         private EventHandler<FinishedEventArgs> _videoViewFinishedEventHandler;
110         private FinishedCallbackDelegate _videoViewFinishedCallbackDelegate;
111
112
113         /// <summary>
114         /// Event for Finished signal which can be used to subscribe/unsubscribe the event handler
115         /// (in the type of FinishedEventHandler-DaliEventHandler<object,FinishedEventArgs>) provided by the user.<br>
116         /// Finished signal is emitted when a video playback have finished.<br>
117         /// </summary>
118         public event EventHandler<FinishedEventArgs> Finished
119         {
120             add
121             {
122                 if (_videoViewFinishedEventHandler == null)
123                 {
124                     _videoViewFinishedCallbackDelegate = (OnFinished);
125                     FinishedSignal().Connect(_videoViewFinishedCallbackDelegate);
126                 }
127                 _videoViewFinishedEventHandler += value;
128             }
129             remove
130             {
131                 _videoViewFinishedEventHandler -= value;
132                 if (_videoViewFinishedEventHandler == null && FinishedSignal().Empty() == false)
133                 {
134                     FinishedSignal().Disconnect(_videoViewFinishedCallbackDelegate);
135                 }
136             }
137         }
138
139         // Callback for VideoView Finished signal
140         private void OnFinished(IntPtr data)
141         {
142             FinishedEventArgs e = new FinishedEventArgs();
143
144             // Populate all members of "e" (FinishedEventArgs) with real data
145             e.VideoView = VideoView.GetVideoViewFromPtr(data);
146
147             if (_videoViewFinishedEventHandler != null)
148             {
149                 //here we send all data to user event handlers
150                 _videoViewFinishedEventHandler(this, e);
151             }
152         }
153
154         internal static VideoView GetVideoViewFromPtr(global::System.IntPtr cPtr)
155         {
156             VideoView ret = new VideoView(cPtr, false);
157             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
158             return ret;
159         }
160
161
162         internal class Property
163         {
164             internal static readonly int VIDEO = NDalicPINVOKE.VideoView_Property_VIDEO_get();
165             internal static readonly int LOOPING = NDalicPINVOKE.VideoView_Property_LOOPING_get();
166             internal static readonly int MUTED = NDalicPINVOKE.VideoView_Property_MUTED_get();
167             internal static readonly int VOLUME = NDalicPINVOKE.VideoView_Property_VOLUME_get();
168         }
169
170         /// <summary>
171         /// Creates an initialized VideoView.
172         /// </summary>
173         public VideoView() : this(NDalicPINVOKE.VideoView_New__SWIG_0(), true)
174         {
175             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
176
177         }
178
179         /// <summary>
180         /// Creates an initialized VideoView.<br>
181         /// If the string is empty, VideoView will not display anything.<br>
182         /// </summary>
183         /// <param name="url">The url of the video resource to display</param>
184         public VideoView(string url) : this(NDalicPINVOKE.VideoView_New__SWIG_1(url), true)
185         {
186             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
187
188         }
189         internal VideoView(VideoView videoView) : this(NDalicPINVOKE.new_VideoView__SWIG_1(VideoView.getCPtr(videoView)), true)
190         {
191             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
192         }
193
194         /// <summary>
195         /// Downcasts a handle to VideoView handle.<br>
196         /// If handle points to a VideoView, the downcast produces valid handle.<br>
197         /// If not, the returned handle is left uninitialized.<br>
198         /// </summary>
199         /// <param name="handle">Handle to an object</param>
200         /// <returns>Handle to a VideoView or an uninitialized handle</returns>
201         internal new static VideoView DownCast(BaseHandle handle)
202         {
203             VideoView ret = new VideoView(NDalicPINVOKE.VideoView_DownCast(BaseHandle.getCPtr(handle)), true);
204             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
205             return ret;
206         }
207
208         /// <summary>
209         /// Starts the video playback.
210         /// </summary>
211         public void Play()
212         {
213             NDalicPINVOKE.VideoView_Play(swigCPtr);
214             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
215         }
216
217         /// <summary>
218         /// Pauses the video playback.
219         /// </summary>
220         public void Pause()
221         {
222             NDalicPINVOKE.VideoView_Pause(swigCPtr);
223             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
224         }
225
226         /// <summary>
227         /// Stops the video playback.
228         /// </summary>
229         public void Stop()
230         {
231             NDalicPINVOKE.VideoView_Stop(swigCPtr);
232             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
233         }
234
235         /// <summary>
236         /// Seeks forward by the specified number of milliseconds.
237         /// </summary>
238         /// <param name="millisecond">The position for forward playback</param>
239         public void Forward(int millisecond)
240         {
241             NDalicPINVOKE.VideoView_Forward(swigCPtr, millisecond);
242             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
243         }
244
245         /// <summary>
246         /// Seeks backward by the specified number of milliseconds.
247         /// </summary>
248         /// <param name="millisecond">The position for backward playback</param>
249         public void Backward(int millisecond)
250         {
251             NDalicPINVOKE.VideoView_Backward(swigCPtr, millisecond);
252             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
253         }
254
255         internal VideoViewSignal FinishedSignal()
256         {
257             VideoViewSignal ret = new VideoViewSignal(NDalicPINVOKE.VideoView_FinishedSignal(swigCPtr), false);
258             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
259             return ret;
260         }
261
262         /// <summary>
263         /// video file url as string type or PropertyMap.
264         /// </summary>
265         public PropertyMap Video
266         {
267             get
268             {
269                 PropertyMap temp = new PropertyMap();
270                 GetProperty(VideoView.Property.VIDEO).Get(temp);
271                 return temp;
272             }
273             set
274             {
275                 SetProperty(VideoView.Property.VIDEO, new Tizen.NUI.PropertyValue(value));
276             }
277         }
278
279         /// <summary>
280         /// looping status, true or false.
281         /// </summary>
282         public bool Looping
283         {
284             get
285             {
286                 bool temp = false;
287                 GetProperty(VideoView.Property.LOOPING).Get(out temp);
288                 return temp;
289             }
290             set
291             {
292                 SetProperty(VideoView.Property.LOOPING, new Tizen.NUI.PropertyValue(value));
293             }
294         }
295
296         /// <summary>
297         /// mute status, true or false.
298         /// </summary>
299         public bool Muted
300         {
301             get
302             {
303                 bool temp = false;
304                 GetProperty(VideoView.Property.MUTED).Get(out temp);
305                 return temp;
306             }
307             set
308             {
309                 SetProperty(VideoView.Property.MUTED, new Tizen.NUI.PropertyValue(value));
310             }
311         }
312
313         /// <summary>
314         /// left and right volume scalar as float type, PropertyMap with two values ( "left" and "right" ).
315         /// </summary>
316         public PropertyMap Volume
317         {
318             get
319             {
320                 PropertyMap temp = new PropertyMap();
321                 GetProperty(VideoView.Property.VOLUME).Get(temp);
322                 return temp;
323             }
324             set
325             {
326                 SetProperty(VideoView.Property.VOLUME, new PropertyValue(value));
327             }
328         }
329
330     }
331
332 }