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