1 /// Copyright 2016 by Samsung Electronics, Inc.,
3 /// This software is the confidential and proprietary information
4 /// of Samsung Electronics, Inc.("Confidential Information"). You
5 /// shall not disclose such Confidential Information and shall use
6 /// it only in accordance with the terms of the license agreement
7 /// you entered into with Samsung.
11 using System.Collections.Generic;
15 namespace Tizen.Content.MediaContent
18 /// A MediaBookmark allows you to mark interesting moment in a media(video and audio) to enable fast searching.
19 /// The MediaBookmark Information API provides functions to get information about bookmarks associated with video and audio items.
21 public class MediaBookmark : IDisposable
23 private IntPtr _bookmarkHandle;
24 private bool _disposedValue = false;
25 internal readonly DateTime _timeStamp;
26 internal readonly String _thumbnailPath;
27 internal readonly String _mediaId;
28 internal MediaBookmark(IntPtr handle)
30 _bookmarkHandle = handle;
38 /// The media bookmark ID
45 MediaContentError res = (MediaContentError)Interop.MediaBookmark.GetBookmarkId(_bookmarkHandle, out id);
46 if (res != MediaContentError.None)
48 Log.Warn(Globals.LogTag, "Failed to get bookmark id");
55 /// The thumbnail path of media bookmark
57 public string ThumbnailPath
62 MediaContentError res = (MediaContentError)Interop.MediaBookmark.GetThumbnailPath(_bookmarkHandle, out path);
63 if (res != MediaContentError.None)
65 Log.Warn(Globals.LogTag, "Failed to get bookmark thumbnail path");
72 /// The bookmark time offset (in milliseconds)
79 MediaContentError res = (MediaContentError)Interop.MediaBookmark.GetMarkedTime(_bookmarkHandle, out time);
80 if (res != MediaContentError.None)
82 Log.Warn(Globals.LogTag, "Failed to get marked time for the bookmark");
89 /// Inserts a new bookmark in media on the specified time offset to the media database.
91 /// <param name="timeStamp">The bookmark time offset (in seconds)</param>
92 /// <param name="thumbnailPath">The thumbnail path of video bookmark. If the media type is audio, then thumbnail is null.</param>
93 public MediaBookmark(MediaInformation content, DateTime time, string thumbnailPath)
95 _mediaId = content.MediaId;
97 if(thumbnailPath != null)
98 _thumbnailPath = thumbnailPath;
100 public void Dispose()
103 GC.SuppressFinalize(this);
106 protected virtual void Dispose(bool disposing)
110 if (_bookmarkHandle != IntPtr.Zero)
112 Interop.Face.Destroy(_bookmarkHandle);
113 _bookmarkHandle = IntPtr.Zero;
115 _disposedValue = true;