2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 namespace Tizen.Multimedia
23 /// Represents a media source with a uri.
26 /// The internet privilege(http://tizen.org/privilege/internet) must be added if any URLs are used to play from a network.
27 /// The mediastorage privilege(http://tizen.org/privilege/mediastorage) must be added if any video/audio files are used to play located in the internal storage.
28 /// The externalstorage privilege(http://tizen.org/privilege/externalstorage) must be added if any video/audio files are used to play located in the external storage.
30 /// <seealso cref="Player.SetSource(MediaSource)"/>
31 /// <since_tizen> 3 </since_tizen>
32 public sealed class MediaUriSource : MediaSource
34 // TODO consider using Uri class.
36 /// Initializes a new instance of the MediaUriSource class with the specified uri.</summary>
37 /// <param name="uri">The uri string.</param>
38 /// <remarks>For HTTP or RSTP, uri should start with "http://" or "rtsp://".
39 /// The default protocol is "file://".
40 /// If you provide an invalid uri, you won't receive an error until <see cref="Player.Start"/> is called.</remarks>
41 /// <since_tizen> 3 </since_tizen>
42 public MediaUriSource(string uri)
44 Uri = uri ?? throw new ArgumentNullException(nameof(uri));
50 /// <since_tizen> 3 </since_tizen>
51 public string Uri { get; }
53 internal override void OnAttached(Player player)
55 NativePlayer.SetUri(player.Handle, Uri).ThrowIfFailed("Failed to set the source with specified uri");