[Multimedia] Add guide for playback 35/153235/3
authorcoderhyme <jhyo.kim@samsung.com>
Thu, 28 Sep 2017 06:22:26 +0000 (15:22 +0900)
committerEditor Lionbridge <TizenEditor.SEL@lionbridge.com>
Fri, 29 Sep 2017 08:12:04 +0000 (11:12 +0300)
PS3: Reviewed

Change-Id: I3cd6258781cb5cfece3eeb6b6309747231e393b7
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
org.tizen.guides/html/dotnet/media/media_playback.htm [new file with mode: 0644]
org.tizen.guides/html/images/player_state_cs.png [new file with mode: 0644]
org.tizen.guides/html/images/videoplayer_interrupted_state_cs.png [new file with mode: 0644]

diff --git a/org.tizen.guides/html/dotnet/media/media_playback.htm b/org.tizen.guides/html/dotnet/media/media_playback.htm
new file mode 100644 (file)
index 0000000..568f8cc
--- /dev/null
@@ -0,0 +1,509 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+       <meta http-equiv="X-UA-Compatible" content="IE=9" />
+       <link rel="stylesheet" type="text/css" href="../../css/styles.css" />
+       <link rel="stylesheet" type="text/css" href="../../css/snippet.css" />
+       <script type="text/javascript" src="../../scripts/snippet.js"></script>
+       <script type="text/javascript" src="../../scripts/jquery.util.js" charset="utf-8"></script>
+       <script type="text/javascript" src="../../scripts/common.js" charset="utf-8"></script>
+       <script type="text/javascript" src="../../scripts/core.js" charset="utf-8"></script>
+       <script type="text/javascript" src="../../scripts/search.js" charset="utf-8"></script>
+
+       <title>Media Playback</title>
+
+</head>
+
+<body onload="prettyPrint()" style="overflow: auto;">
+
+<div id="toc-navigation">
+
+       <div id="toc_border"><div id="toc">
+               <p class="toc-title">Dependencies</p>
+               <ul class="toc">
+                       <li>Tizen 4.0 and Higher</li>
+               </ul>
+
+               <p class="toc-title">Content</p>
+        <ul class="toc">
+                       <li><a href="#audio">Audio Player</a></li>
+                       <li><a href="#video">Video Player</a></li>
+                       <li><a href="#features">Player Features</a></li>
+                       <li><a href="#stream">Playback Streams</a></li>
+                       <li><a href="#wav">WAV Player</a></li>
+                       <li><a href="#tone">Tone Player</a></li>
+                       <li><a href="#prerequisites">Prerequisites</a></li>
+            <li>Player
+                <ul class="toc">
+                                       <li><a href="#prepare">Preparing the Player</a></li>
+                    <li><a href="#play_audio">Playing an Audio File</a></li>
+                    <li><a href="#play_video">Playing a Video File</a></li>
+                    <li><a href="#release">Stopping the Player</a></li>
+                    <li><a href="#set_parameters">Configuring the Video Playback Display</a></li>
+                    <li><a href="#get_stream">Retrieving Stream Information</a></li>
+                    <li><a href="#insert">Inserting Subtitles</a></li>
+                </ul>
+            </li>
+            <li>WAV player
+                <ul class="toc">
+                    <li><a href="#start_wav">Starting and Stopping the WAV Player</a></li>
+                </ul>
+            </li>
+            <li>Tone player
+                <ul class="toc">
+                                       <li><a href="#play_tone">Playing a Tone</a></li>
+                                       <li><a href="#duration">Playing a Tone for a Specified Duration</a></li>
+                </ul>
+            </li>
+        </ul>
+               <p class="toc-title">Related Info</p>
+               <ul class="toc">
+                       <li><a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1Player.html">Tizen.Multimedia.Player Class</a></li>
+                       <li><a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1WavPlayer.html">Tizen.Multimedia.WavPlayer Class</a></li>
+                       <li><a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1TonePlayer.html">Tizen.Multimedia.TonePlayer Class</a></li>
+               </ul>
+       </div></div>
+</div>
+
+<div id="container"><div id="contents"><div class="content">
+<h1>Media Playback</h1>
+
+<p>You can play different audio formats and video in your application.</p>
+
+<p>The main media playback features are:</p>
+  <ul>
+    <li>Handling audio
+       <p>Enables you to play <a href="#audio">audio</a> and control the playback.</p></li>
+       <li>Handling video
+       <p>Enables you to play <a href="#video">video</a>.</p></li>
+       <li>Using the player <a href="#features">features</a>
+       <p>Enables you manage the player and control the volume, sound mode, display, stream info, and audio effects.</p></li>
+       <li>Streaming playback
+       <p>Enables you to set specific URLs for <a href="#stream">streaming media playback</a>.</p></li>
+       <li>Using the WAV player
+       <p>Enables you to play audio in the <a href="#wav">WAVE format</a>.</p></li>
+       <li>Using the tone player
+       <p>Enables you to play <a href="#tone">tones</a>.</p></li>
+</ul>
+
+<p>Before you start, <a href="#prepare">set up the player</a>.</p>
+
+<h2 id="audio">Audio Player</h2>
+
+<p>You can <a href="#play_audio">play audio</a> and control functions for using audio resources. The resources can be media files stored on the device in a file or memory, or they can be streamed from a streaming server (defined with a URI) through the network.</p>
+<p>The supported audio formats include MP3, AAC, WMA, M4A, 3GA, WAV, and AMR. The available formats depend on the target device.</p>
+<p>You can use multiple instances of the player to play several audio data streams concurrently. This means that your application can play multiple uncompressed audio files at the same time.</p>
+
+<p>The following figure illustrates the general player state changes.</p>
+<p align="center"><strong>Figure: Player state changes</strong></p>
+<p align="center"><img src="../../images/player_state_cs.png" alt="Player state changes" style="display: block; text-align: center; margin-left: auto; margin-right: auto;"/></p>
+
+<p>The <code>PlaybackInterrupted</code> event of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1Player.html">Tizen.Multimedia.Player</a> class is triggered when the application is interrupted by another application. The player is paused or moved to the <code>Idle</code> state according to the audio session manager (ASM) policy. You must check the state of the current instance and take appropriate action.</p>
+
+<h2 id="video">Video Player</h2>
+
+<p>Tizen enables your application to <a href="#play_video">play video</a>, and it uses its own user surface. The surface requires a drawing area, so you have to get an overlay region and set it to the player instance to display the drawing area:</p>
+<ol>
+    <li>Get the UI component to display from the Graphics module.
+       <p>You can display video on a UI layer of Evas, Xamarin, and NUI.</p></li>
+    <li>Create the player instance.</li>
+    <li>Create the display instance with the UI component you got.</li>
+    <li>Set the display to the player using the <code>Display</code> property of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1Player.html">Tizen.Multimedia.Player</a> class.</li>
+</ol>
+
+<p>The supported video formats include WMV, ASF, MP4, 3GP, AVI, MKV, and OGG. The available formats depend on the target device.</p>
+<p>In the case of a video interruption, the player state can be <code>Ready</code> due to the resource restriction in the system.</p>
+
+<p>The following figure illustrates what happens when the player gets interrupted by the system.</p>
+<p align="center"><strong>Figure: Player states when interrupted by system</strong></p>
+<p align="center"><img alt="Player states when interrupted by system" src="../../images/videoplayer_interrupted_state_cs.png"/></p>
+
+
+<h2 id="features">Player Features</h2>
+
+<p>The <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1Player.html">Tizen.Multimedia.Player</a> class provides the following features:</p>
+
+<ul>
+       <li>Operating general controls for the <a href="#audio">audio</a> and <a href="#video">video</a> content, such as play, pause, resume, and stop
+       <p>The player has events you can use to receive notifications of player status changes during playback. Since the player engine works asynchronously, you must implement event handlers to ensure that the player flows correctly. When each player operation is completed, the <code>PlaybackCompleted</code> event of the <code>Tizen.Multimedia.Player</code> class is raised. If an error occurs in the player engine, you can be notified through the <code>ErrorOccurred</code> event.</p></li>
+       <li>Modifying playback properties
+       <p>After the player state is changed to <code>Ready</code>, you can modify various playback properties, such as volume, sound type, latency mode, mute mode, and looping mode.</p></li>
+       <li>Moving the audio and video content based on time</li>
+       <li>Controlling the volume of the audio and video content based on each instance
+       <p>The player works based on the audio session manager policy. This means that an application can be interrupted by another application. You can change the policy directly by using the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1AudioStreamPolicy.html">Tizen.Multimedia.AudioStreamPolicy</a> class.</p></li>
+       <li>Getting information about the audio and video content
+       <p>After the player state is changed to <code>Ready</code>, the multimedia resource is available and you can get content information from the media. You can also get content information in the <code>Playing</code> state, in some cases of playback streaming.</p></li>
+       <li>Playing multiple audio streams
+       <p>The maximum number of player instances is limited by the system and multimedia resources. The maximum number is a system-wide count and it can be applied depending on the CPU model, CPU speed, CPU core number, CPU load from other applications, and the available memory. Thus, the exact number can be smaller than the maximum number, in which case the prepare methods fail. A reasonable working player number is under 10. To free up system resources, <a href="#release">stop unneeded players</a>.</p></li>
+       <li>Display
+       <p>Use the <code>Display</code> property of the <code>Tizen.Multimedia.Player</code> class to play a video stream.</p>
+       <p>After the player state is changed to <code>Idle</code>, create the display and <a href="#set_parameters">set the display settings</a>.</p></li>
+       <li>Stream information
+       <p>Use the <code>StreamInfo</code> property of the <code>Tizen.Multimedia.Player</code> class to play a video stream.</p>
+       <p>After the player state is changed to <code>Ready</code>, you can <a href="#get_stream">retrieve stream properties</a>.</p></li>
+       <li>Audio effect
+    <p>Use the <code>AudioEffect</code> property of the <code>Tizen.Multimedia.Player</code> class to set and get audio effects for the playback.</p>
+       <p>After the player state is changed to <code>Idle</code>, you can adjust the audio effects.</p></li>
+       <li>Subtitles
+    <p>Use the <code>SetSubtitle()</code> method of the <code>Tizen.Multimedia.Player</code> class to set a path for inserting subtitles to a video file.</p>
+    <p>After the player state is changed to <code>Ready</code>, you can <a href="#insert">read the subtitle track</a>.</p></li>
+  </ul>
+
+
+<h2 id="stream">Playback Streams</h2>
+
+<p>You can set specific URLs for streaming media playback with the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1MediaUriSource.html">Tizen.Multimedia.MediaUriSource</a> class.</p>
+<p>Both Hypertext Transfer Protocol (HTTP) and Real Time Streaming Protocol (RTSP) protocols support streaming media   playback. The HTTP request header supports the playback of both complete and download-in-progress media files. The index table (atoms) must be moved in front of the file for progressive download.</p>
+<p>For HTTP streaming, buffering can happen when the player is prepared. You can receive the status using the <code>BufferingProgressChanged</code> event of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1Player.html">Tizen.Multimedia.Player</a> class.</p>
+<p>The following table lists the streaming protocol features supported by the player.</p>
+
+   <p align="center" class="Table"><strong>Table: Supported streaming protocol features</strong></p>
+  <table>
+   <tbody>
+    <tr>
+     <th>Streaming protocol</th>
+     <th>Supported feature</th>
+    </tr>
+    <tr>
+     <td rowspan="3">Hypertext Transfer Protocol (HTTP)</td>
+     <td>HTTP Streaming</td>
+    </tr>
+    <tr>
+     <td>HTTP Live Streaming</td>
+    </tr>
+    <tr>
+     <td>HTTP Progressive Download Play</td>
+    </tr>
+    <tr>
+     <td>Real Time Streaming Protocol (RTSP)</td>
+     <td>RTSP Streaming</td>
+    </tr>
+   </tbody>
+  </table>
+
+<h2 id="wav">WAV Player</h2>
+
+<p>The <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1WavPlayer.html">Tizen.Multimedia.WavPlayer</a> class allows you to play audio resources (media files stored on the device). Use it to <a href="#start_wav">play audio and control playback</a>. You can use the WAV and OGG audio formats.</p>
+
+<p>Multiple instances of the WAV player can be used to play several audio data streams concurrently. This means that your application can play multiple uncompressed audio files, such as WAV, at the same time.</p>
+
+<h2 id="tone">Tone Player</h2>
+
+<p>You can play a tone or a list of tones using the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1TonePlayer.html">Tizen.Multimedia.TonePlayer</a> class.</p>
+<p>To play tones, use a DTMF (Dual Tone Multi Frequency) preset frequency. The possible values are defined in the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1Multimedia.html#afdd3ce695faee1498baba043758ec4c4">Tizen.Multimedia.ToneType</a> enumeration.</p>
+
+<p>You can <a href="#play_tone">start and stop playing a tone</a>, and <a href="#duration">play a tone for a specified duration</a>.</p>
+
+
+<h2 id="prerequisites">Prerequisites</h2>
+
+<p>To use the methods and properties of the media playback classes, include the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1Multimedia.html">Tizen.Multimedia</a> namespace in your application:</p>
+<pre class="prettyprint">
+using Tizen.Multimedia;
+</pre>
+
+<h2 id="prepare">Preparing the Player</h2>
+
+<p>To initialize the player for use:</p>
+
+<ol>
+       <li id="init_handle">Create a instance of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1Player.html">Tizen.Multimedia.Player</a> class:
+<pre class="prettyprint">
+var player = new Player();
+</pre>
+       </li>
+       <li>To receive notifications, add event handlers to the appropriate events of the <code>Tizen.Multimedia.Player</code> class:
+               <ul>
+                       <li>To receive notifications about playback interruptions, register an event handler for the <code>PlaybackInterrupted</code> event:
+<pre class="prettyprint">
+player.PlaybackInterrupted += (object sender, PlaybackInterruptedEventArgs e)
+{
+    Tizen.Log.Info(LogTag, $"Current player state is {player.State}");
+    /// If the state is Paused, update the UI (for example, button)
+};
+</pre>
+                       <p>The playback is interrupted and the event is raised when, for example, another multimedia application is run. The player state automatically changes to <code>Paused</code> or <code>Idle</code> according to the session policy.</p>
+                       </li>
+                       <li>To receive a notification when the playback ends, register an event handler for the <code>PlaybackCompleted</code> event:
+<pre class="prettyprint">
+player.PlaybackCompleted += (object sender, EventArgs e)
+{
+   Tizen.Log.Info(LogTag, "Playback End");
+};
+</pre>
+                       </li>
+                       <li>To receive notifications about player errors during playback, register an event handler for the <code>ErrorOccurred</code> event:
+<pre class="prettyprint">
+player.ErrorOccurred += (object sender, PlayerErrorOccurredEventArgs e)
+{
+    Tizen.Log.Error(LogTag, $"Playback failed, error = {e.Error}");
+};
+</pre>
+                       <p>The player error event is raised when the player stops working due to an error. You can use the event to try to recover from the error. For example, try to change the player state to <code>Ready</code> by calling the <code>Stop()</code> method of the <code>Tizen.Multimedia.Player</code> class, and then reset the player by calling the <code>Unprepare()</code> method.</p>
+                       </li>
+               </ul>
+       </li>
+</ol>
+
+<h2 id="play_audio">Playing an Audio File</h2>
+
+<p>To play an audio file:</p>
+
+<ol>
+       <li>After creating the player, specify the audio file to play by creating an instance of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1MediaUriSource.html">Tizen.Multimedia.MediaUriSource</a> class with the path to the audio file, and setting that as the <code>Source</code> property of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1Player.html">Tizen.Multimedia.Player</a> class instance you want to play the file with:
+<pre class="prettyprint">
+player.Source = new MediaUriSource(audioPath);
+</pre>
+       </li>
+       <li>Prepare the player for playback using the <code>PrepareAsync()</code> method of the <code>Tizen.Multimedia.Player</code> class:
+<pre class="prettyprint">
+await player.PrepareAsync();
+</pre>
+       <p>The method changes the player state from <code>Idle</code> to <code>Ready</code>, which is required to start playback.</p>
+       </li>
+       <li>Start playing the audio file using the <code>Start()</code> method:
+<pre class="prettyprint">
+player.Start();
+</pre>
+       <p>This changes the player state from <code>Ready</code> to <code>Playing</code>. The audio file plays until you call the <code>Stop()</code> or <code>Pause()</code> method.</p>
+       </li>
+</ol>
+
+<h2 id="play_video">Playing a Video File</h2>
+
+<p>To play a video file:</p>
+
+<ol>
+       <li>After creating the player, specify the video file to play by creating an instance of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1MediaUriSource.html">Tizen.Multimedia.MediaUriSource</a> class with the path to the audio file, and setting that as the <code>Source</code> property of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1Player.html">Tizen.Multimedia.Player</a> class instance you want to play the file with:
+<pre class="prettyprint">
+player.Source = new MediaUriSource(videoPath);
+</pre>
+       </li>
+       <li>To set the display on which the video is played, use the <code>Display</code> property of the <code>Tizen.Multimedia.Player</code> class.
+       <p>For example, to set the display on a Xamarin-based application, first create an instance of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Xamarin_1_1Forms_1_1Extension_1_1MediaView.html">Tizen.Xamarin.Forms.Extension.MediaView</a> class, cast it to an instance of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1MediaView.html">Tizen.Multimedia.MediaView</a> class, and finally set that instance as the <code>Display</code> property:</p>
+<pre class="prettyprint">
+var mediaView = new Tizen.Xamarin.Forms.Extension.MediaView();
+
+mediaView.NativeViewCreated += (s, e) =>
+{
+    player.Display = new Display((Tizen.Multimedia.MediaView)mediaView.NativeView);
+};
+</pre>
+       </li>
+       <li>
+<p>Prepare the player for playback using the <code>PrepareAsync()</code> method of the <code>Tizen.Multimedia.Player</code> class:</p>
+<pre class="prettyprint">
+await player.PrepareAsync();
+</pre>
+       <p>This method changes the player state from <code>Idle</code> to <code>Ready</code>, which is required to start playback.</p>
+       </li>
+       <li>Play the video file, using the <code>Start()</code> method:
+<pre class="prettyprint">
+player.Start();
+</pre>
+<p>This changes the player state from <code>Ready</code> to <code>Playing</code>. The video file plays until you call the <code>Stop()</code> or <code>Pause()</code> method.</p>
+       </li>
+</ol>
+
+
+<h2 id="release">Stopping the Player</h2>
+
+<p>To stop and reset the player:</p>
+
+<ol>
+       <li>Stop the player using the <code>Stop()</code> method of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1Player.html">Tizen.Multimedia.Player</a> class:
+<pre class="prettyprint">
+player.Stop();
+</pre>
+       </li>
+       <li>Reset the player using the <code>Unprepare()</code> method:
+<pre class="prettyprint">
+player.Unprepare();
+</pre>
+       <p>After the player is reset, it is in the <code>Idle</code> state.</p>
+       </li>
+</ol>
+
+
+<h2 id="set_parameters">Configuring the Video Playback Display</h2>
+
+<p>You set the display parameters of a video file with the <code>DisplaySettings</code> property of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1Player.html">Tizen.Multimedia.Player</a> class, which takes an instance of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1PlayerDisplaySettings.html">Tizen.Multimedia.PlayerDisplaySettings</a> class as its value:</p>
+
+<ol>
+       <li>Make sure that the <a href="#play_video">display is set, and the player prepared and started</a>.</li>
+       <li>To make the display visible:
+               <ol type="a">
+                       <li>Check whether the display is already visible using the <code>IsVisible</code> property of the <code>Tizen.Multimedia.PlayerDisplaySettings</code> class:
+<pre class="prettyprint">
+Tizen.Log.Info(LogTag, $"Display visible = {player.DisplaySettings.IsVisible}");
+</pre>
+                       </li>
+                       <li>If the display is not visible, make it visible by setting the <code>IsVisible</code> property to <code>true</code>:
+<pre class="prettyprint">
+if (player.DisplaySettings.IsVisible == false)
+{
+    player.DisplaySettings.IsVisible = true;
+}
+</pre>
+                       </li>
+               </ol>
+       </li>
+       <li>Set the display mode using the <code>Mode</code> property, which takes the display mode as a value of the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1Multimedia.html#a7191d3d1fd2058eb482820d9e41f195b">Tizen.Multimedia.PlayerDisplayMode</a> enumeration:
+<pre class="prettyprint">
+player.DisplaySettings.Mode = PlayerDisplayMode.FullScreen;
+</pre>
+       </li>
+       <li>Set the display rotation using the <code>Rotation</code> property, which takes the display rotation as a value of the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1Multimedia.html#a763f8e5a97a259b61e50fe32f7f9f7b4">Tizen.Multimedia.PlayerDisplayRotation</a> enumeration:
+<pre class="prettyprint">
+player.DisplaySettings.Rotation = Rotation.Rotate90;
+</pre>
+       </li>
+</ol>
+
+<h2 id="get_stream">Retrieving Stream Information</h2>
+
+<p>To retrieve information about the audio and video streams:</p>
+
+<ol>
+       <li><a href="#play_video">Prepare and start the player</a>, and <a href="#set_parameters">set the display parameters</a>.
+
+       <div class="note">
+        <strong>Note</strong>
+        To retrieve the stream information, the player state must be either <code>Playing</code> or <code>Paused</code>.
+       </div>
+       </li>
+       <li>Retrieve the stream information:
+               <ul>
+                       <li>Duration
+                       <p>Retrieve the total media running time (in milliseconds) using the <code>GetDuration()</code> method of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1StreamInfo.html">Tizen.Multimedia.StreamInfo</a> class:</p>
+<pre class="prettyprint">
+Tizen.Log.Info(LogTag, $"Duration = {player.StreamInfo.GetDuration()}");
+</pre>
+                       </li>
+                       <li>Audio stream details
+                       <p>Retrieve the audio stream details using the <code>GetAudioProperties()</code> method. The method returns an instance of the <a href="https://developer.tizen.org/dev-guide/csapi/structTizen_1_1Multimedia_1_1AudioStreamProperties.html">Tizen.Multimedia.AudioStreamProperties</a> struct containing the audio sample rate (in Hz), number of audio channels (1 for mono or 2 for stereo), and audio bit rate (in Hz).</p>
+<pre class="prettyprint">
+var audioProperties = player.StreamInfo.GetAudioProperties();
+
+Tizen.Log.Info(LogTag, $"Sample rate = {audioProperties.SampleRate}, Channels = {audioProperties.Channels}, Bit rate = {audioProperties.BitRate}");
+</pre>
+                       </li>
+                       <li>Video stream details
+                       <p>Retrieve the video stream details using the <code>GetVideoProperties()</code> method. The method returns an instance of the <a href="https://developer.tizen.org/dev-guide/csapi/structTizen_1_1Multimedia_1_1VideoStreamProperties.html">Tizen.Multimedia.VideoStreamProperties</a> struct containing the video size, number of frames per second, and video bit rate (in Hz).</p>
+<pre class="prettyprint">
+var videoProperties = player.StreamInfo.GetVideoProperties();
+
+Tizen.Log.Info(LogTag, $"Video size = {videoProperties.Size}, Fps = {videoProperties.Fps}, Bit rate = {videoProperties.BitRate}");
+</pre>
+                       </li>
+                       <li>Audio and video codec names
+                       <p>Retrieve the audio and video codec names using the <code>GetAudioCodec()</code> and the <code>GetVideoCodec()</code> methods:</p>
+<pre class="prettyprint">
+Tizen.Log.Info(LogTag, $"Audio codec = {player.StreamInfo.GetAudioCodec()}");
+Tizen.Log.Info(LogTag, $"Video codec = {player.StreamInfo.GetVideoCodec()}");
+</pre>
+                       </li>
+                       <li>Content metadata
+                       <p>Retrieve information about the album, artist, author, genre, title, and year using the <code>GetMetadata()</code> method. The available metadata attributes are defined in the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1Multimedia.html#aba4cec028a35e061025a4d10dfb2b806">Tizen.Multimedia.StreamMetadataKey</a> enumeration.</p>
+
+<pre class="prettyprint">
+Tizen.Log.Info(LogTag, $"Album = {player.StreamInfo.GetMetadata(StreamMetadataKey.Alarm)}");
+Tizen.Log.Info(LogTag, $"Artist = {player.StreamInfo.GetMetadata(StreamMetadataKey.Artist)}");
+Tizen.Log.Info(LogTag, $"Author = {player.StreamInfo.GetMetadata(StreamMetadataKey.Author)}");
+Tizen.Log.Info(LogTag, $"Genre = {player.StreamInfo.GetMetadata(StreamMetadataKey.Genre)}");
+Tizen.Log.Info(LogTag, $"Title = {player.StreamInfo.GetMetadata(StreamMetadataKey.Title)}");
+Tizen.Log.Info(LogTag, $"Year = {player.StreamInfo.GetMetadata(StreamMetadataKey.Year)}");
+</pre>
+                       </li>
+                       <li>Album artwork
+                       <p>Retrieve the album artwork using the <code>GetAlbumArt()</code> method. The method returns the encoded artwork image.</p>
+<pre class="prettyprint">
+byte[] imageData = player.StreamInfo.GetAlbumArt();
+</pre>
+                       </li>
+               </ul>
+       </li>
+</ol>
+
+<h2 id="insert">Inserting Subtitles</h2>
+
+<p>To insert subtitles to a video file, set the subtitle path using the <code>SetSubtitle()</code> method of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1Player.html">Tizen.Multimedia.Player</a> class:</p>
+<pre class="prettyprint">
+player.SetSubtitle(subtitlePath);
+</pre>
+
+
+<h2 id="start_wav">Starting and Stopping the WAV Player</h2>
+
+<p>To start and stop the WAV player:</p>
+
+<ol>
+       <li>To play a WAV file, use the <code>StartAsync()</code> method of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1WavPlayer.html">Tizen.Multimedia.WavPlayer</a> class:
+<pre class="prettyprint">
+await WavPlayer.StartAsync(wavPath, new AudioStreamPolicy(AudioStreamType.Media));
+</pre>
+       <p>To set the path of your WAV file, you potentially need to retrieve the default path for audio files.</p>
+       </li>
+       <li>To stop the WAV player, use the <code>StartAsync()</code> method with the <code>cancellationToken</code> parameter:
+<pre class="prettyprint">
+var cancellationTokenSource = new CancellationTokenSource();
+
+WavPlayer.StartAsync(wavPath, new AudioStreamPolicy(AudioStreamType.Media), cancellationTokenSource);
+
+cancellationTokenSource.Cancel();
+</pre>
+       </li>
+</ol>
+
+<h2 id="play_tone">Playing a Tone</h2>
+
+<p>To start and stop playing a tone:</p>
+
+<ol>
+       <li>To start playback, use the <code>StartAsync()</code> method of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1TonePlayer.html">Tizen.Multimedia.TonePlayer</a> class.
+       <p>The first parameter defines the tone type as a value of the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1Multimedia.html#afdd3ce695faee1498baba043758ec4c4">Tizen.Multimedia.ToneType</a> enumeration.</p>
+<pre class="prettyprint">
+await TonePlayer.StartAsync(ToneType.Default, new AudioStreamPolicy(AudioStreamType.Media));
+</pre>
+       </li>
+       <li>To stop playback, use the <code>StartAsync()</code> method with the <code>cancellationToken</code> parameter:
+<pre class="prettyprint">
+var cancellationTokenSource = new CancellationTokenSource();
+
+TonePlayer.StartAsync(ToneType.Default, new AudioStreamPolicy(AudioStreamType.Media), cancellationTokenSource);
+
+cancellationTokenSource.Cancel();
+</pre>
+       </li>
+</ol>
+
+<h2 id="duration">Playing a Tone for a Specified Duration</h2>
+
+<p>To play a tone for a specified duration, use the <code>StartAsync()</code> method of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1TonePlayer.html">Tizen.Multimedia.TonePlayer</a> class with the duration parameter (the number of milliseconds you want playback to last). When you set the duration to a specified time, playback stops automatically after that time.</p>
+<pre class="prettyprint">
+await TonePlayer.StartAsync(ToneType.Default, new AudioStreamPolicy(AudioStreamType.Media), duration);
+</pre>
+
+<script type="text/javascript" src="../../scripts/jquery.zclip.min.js"></script>
+<script type="text/javascript" src="../../scripts/showhide.js"></script>
+</div></div></div>
+
+
+<a class="top sms" href="#"><img src="../../images/btn_top.gif" alt="Go to top"/></a>
+
+<div id="footer">
+<p class="footer">Except as noted, this content - excluding the Code Examples - is licensed under <a href="http://creativecommons.org/licenses/by/3.0/legalcode" target="_blank">Creative Commons Attribution 3.0</a> and all of the Code Examples contained herein are licensed under <a href="https://www.tizen.org/bsd-3-clause-license" target="_blank">BSD-3-Clause</a>.<br/>For details, see the <a href="https://www.tizen.org/content-license" target="_blank">Content License</a>.</p>
+</div>
+
+<script type="text/javascript">
+var _gaq = _gaq || [];
+_gaq.push(['_setAccount', 'UA-25976949-1']);
+_gaq.push(['_trackPageview']);
+(function() {
+var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+})();
+</script>
+</body></html>
diff --git a/org.tizen.guides/html/images/player_state_cs.png b/org.tizen.guides/html/images/player_state_cs.png
new file mode 100644 (file)
index 0000000..1d3bc7b
Binary files /dev/null and b/org.tizen.guides/html/images/player_state_cs.png differ
diff --git a/org.tizen.guides/html/images/videoplayer_interrupted_state_cs.png b/org.tizen.guides/html/images/videoplayer_interrupted_state_cs.png
new file mode 100644 (file)
index 0000000..c3b4b3b
Binary files /dev/null and b/org.tizen.guides/html/images/videoplayer_interrupted_state_cs.png differ