Release 4.0.0-preview1-00172
[platform/core/csapi/tizenfx.git] / src / Tizen.Content.MediaContent / Tizen.Content.MediaContent / Bookmark.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18
19 namespace Tizen.Content.MediaContent
20 {
21     /// <summary>
22     /// Represents the media bookmark that allows you to mark an interesting moment
23     /// in media (video and audio) to enable fast searching.
24     /// </summary>
25     public class Bookmark
26     {
27         internal Bookmark(IntPtr handle)
28         {
29             Id = InteropHelper.GetValue<int>(handle, Interop.Bookmark.GetId);
30             ThumbnailPath = InteropHelper.GetString(handle, Interop.Bookmark.GetThumbnailPath);
31             Offset = InteropHelper.GetValue<int>(handle, Interop.Bookmark.GetMarkedTime);
32             Name = InteropHelper.GetString(handle, Interop.Bookmark.GetName);
33         }
34
35         /// <summary>
36         /// Gets the ID of the bookmark.
37         /// </summary>
38         /// <value>The ID of the bookmark.</value>
39         public int Id { get; }
40
41         /// <summary>
42         /// Gets the thumbnail path of the bookmark.
43         /// </summary>
44         /// <value>The thumbnail path of the bookmark.</value>
45         public string ThumbnailPath { get; }
46
47         /// <summary>
48         /// Gets the offset in milliseconds.
49         /// </summary>
50         /// <value>The offset of the bookmark in media in milliseconds.</value>
51         public int Offset { get; }
52
53         /// <summary>
54         /// Gets the name of the bookmark.
55         /// </summary>
56         /// <value>The name of the bookmark.</value>
57         public string Name { get; }
58
59         internal static Bookmark FromHandle(IntPtr handle) => new Bookmark(handle);
60
61         /// <summary>
62         /// Returns a string representation of the bookmark.
63         /// </summary>
64         /// <returns>A string representation of the current bookmark.</returns>
65         public override string ToString() =>
66             $"Id={Id}, Name={Name}, ThumbnailPath={ThumbnailPath}, Offset={Offset}";
67     }
68 }