[Multimedia] Add guide for the Radio 53/152653/2
authorcoderhyme <jhyo.kim@samsung.com>
Tue, 26 Sep 2017 23:29:59 +0000 (08:29 +0900)
committerEditor Lionbridge <TizenEditor.SEL@lionbridge.com>
Thu, 28 Sep 2017 09:52:09 +0000 (12:52 +0300)
PS2: Reviewed

Change-Id: Ibe09d370cd0a18b0c3e8eeeaff3e5d4df68092ef
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
org.tizen.guides/html/dotnet/media/radio.htm [new file with mode: 0644]

diff --git a/org.tizen.guides/html/dotnet/media/radio.htm b/org.tizen.guides/html/dotnet/media/radio.htm
new file mode 100644 (file)
index 0000000..cc4488b
--- /dev/null
@@ -0,0 +1,194 @@
+<!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>Radio</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="#prerequisites">Prerequisites</a></li>
+            <li><a href="#scan">Scanning for Radio Frequencies</a></li>
+            <li><a href="#tune">Tuning the Radio</a></li>
+            <li><a href="#seek">Searching for an Adjacent Channel</a></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_1Radio.html">Tizen.Multimedia.Radio Class</a></li>
+               </ul>
+       </div></div>
+</div>
+
+<div id="container"><div id="contents"><div class="content">
+
+<h1>Radio</h1>
+
+<p>You can control the radio hardware in a device to provide radio playback in your application.</p>
+
+<p>The main features of the <code>Tizen.Multimedia.Radio</code> class include:</p>
+
+<ul>
+  <li>Switching the radio on and off
+  <p>You can switch the radio on and off using the <code>Start()</code> and <code>Stop()</code> methods of the <code>Tizen.Multimedia.Radio</code> class.</p></li>
+  <li>Scanning for radio frequencies
+  <p>You can <a href="#scan">scan for all available frequencies</a>.</p></li>
+  <li>Tuning the radio
+  <p>You can <a href="#tune">select and start playing a radio frequency</a> by using the <code>Frequency</code> property of the <code>Tizen.Multimedia.Radio</code> class.</p></li>
+  <li>Searching for an adjacent channel
+  <p>You can <a href="#seek">seek an adjacent channel</a> with the <code>SeekUpAsync()</code> and <code>SeekDownAsync()</code> methods.</p></li>
+</ul>
+
+<p>You can only have one radio instance active at a time. Radio playback can be interrupted by another radio application.</p>
+
+<h2 id="prerequisites">Prerequisites</h2>
+
+<p>To enable your application to use the radio functionality:</p>
+<ol>
+       <li>To use the methods and properties of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1Radio.html">Tizen.Multimedia.Radio</a> class, include the <a href="https://developer.tizen.org/dev-guide/csapi/namespaceTizen_1_1Multimedia.html">Tizen.Multimedia</a> namespace in your application:
+<pre class="prettyprint">
+using Tizen.Multimedia;
+</pre>
+       </li>
+       <li>Create an instance of the <code>Tizen.Multimedia.Radio</code> class:
+<pre class="prettyprint">
+Radio radio = new Radio();
+</pre>
+       </li>
+       <li>To receive notifications when radio playback is interrupted, register an event handler for the <code>Interrupted</code> event of the <code>Tizen.Multimedia.Radio</code> class. Radio playback is interrupted, for example, when the radio application moves to the background.
+<pre class="prettyprint">
+radio.Interrupted += OnRadioInterrupted;
+
+void OnRadioInterrupted(object sender, RadioInterruptedEventArgs args)
+{
+    switch (args.Reason)
+    {
+        case RadioInterruptedReason.ResourceConflict:
+            /// Application that was the source of the conflict is now closed
+            /// Restart the radio playback here
+            break;
+        default:
+            /// Radio listening is interrupted
+            /// Release the application resources or save the current state here
+            break;
+    }
+}
+</pre>
+</li>
+</ol>
+
+<h2 id="scan">Scanning for Radio Frequencies</h2>
+
+<p>To scan for all available radio frequencies:</p>
+
+<ol>
+       <li>Register and define event handlers for the events of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1Radio.html">Tizen.Multimedia.Radio</a> class:
+       <ul>
+       <li>To receive a notification each time the scan finds a new frequency, register an event handler for the <code>ScanUpdated</code> event. The event provides the kHz value of the found frequency.
+<pre class="prettyprint">
+radio.ScanCompleted += OnScanCompleted;
+
+void OnScanUpdated(object sender, ScanUpdatedEventArgs args)
+{
+    /// Store the radio channels in the array
+    /// Frequency values represent the kHz of the channel
+    Tizen.Log.Info("Radio", $"Frequency: {args.Frequency}");
+}
+</pre>
+
+  <div class="note">
+        <strong>Note</strong>
+        Do not use radio operations (such as changing the <code>Frequency</code> property value or calling the <code>Start()</code> method) in the scan updated event handler.
+    </div>
+</li>
+       <li>To receive a notification when the scan is complete, register an event handler for the <code>ScanCompleted</code> event:
+<pre class="prettyprint">
+radio.ScanCompleted += OnScanCompleted;
+
+void OnScanCompleted(object sender, EventArgs args)
+{
+    /// Frequency scanning is completed
+    /// Tune in to one of the scanned frequencies and start listening
+}
+</pre>
+       </li>
+       </ul>
+       </li>
+       <li>Start scanning using the <code>StartScan()</code> method of the <code>Tizen.Multimedia.Radio</code> class:
+<pre class="prettyprint">
+radio.StartScan();
+</pre>
+       <p>The scanning time depends on the environment (the strength of the radio signal).</p>
+       <p>To cancel the scan before it completes, use the <code>StopScan()</code> method.</p>
+       </li>
+</ol>
+
+<h2 id="tune">Tuning the Radio</h2>
+
+<p>To select and start playing a frequency:</p>
+
+<ol>
+       <li>Set the frequency you want to play using the <code>Frequency</code> property of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1Radio.html">Tizen.Multimedia.Radio</a> class:
+<pre class="prettyprint">
+radio.Frequency = newFrequncey;
+</pre>
+       </li>
+       <li>Start playing the frequency using the <code>Start()</code> method of the <code>Tizen.Multimedia.Radio</code> class:
+<pre class="prettyprint">
+radio.Start();
+</pre>
+       <p>If the radio emits no sound, check the signal strength with the <code>SignalStrength</code> property of the <code>Tizen.Multimedia.Radio</code> class. The property returns the current signal strength as a dBuV value.</p>
+       </li>
+</ol>
+
+<h2 id="seek">Searching for an Adjacent Channel</h2>
+
+<p>To search for and tune in to an adjacent channel, use the <code>SeekUpAsync()</code> and <code>SeekDownAsync()</code> methods of the <a href="https://developer.tizen.org/dev-guide/csapi/classTizen_1_1Multimedia_1_1Radio.html">Tizen.Multimedia.Radio</a> class. This is similar to the scanning operation, but only the nearest active frequency is searched for. Once the maximum frequency is reached in either direction, the search ends, and the radio is set to that frequency.</p>
+<p>For example, to seek down, use the <code>SeekDownAsync()</code> method:</p>
+<pre class="prettyprint">
+var newFrequncey = await radio.SeekDownAsync();
+
+/// Search is complete, and the radio is tuned in to the new frequency
+/// Application sets the new frequency and updates the user interface
+</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>