\section{KDE::Play\-Object Class Reference}
\label{classKDE_1_1PlayObject}\index{KDE::PlayObject@{KDE::PlayObject}}
This class acts as a general interface to the {\bf KDE} multimedia framework.  


{\tt \#include $<$kplayobject.h$>$}

Inheritance diagram for KDE::Play\-Object:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=63pt]{classKDE_1_1PlayObject__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KDE::Play\-Object:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=63pt]{classKDE_1_1PlayObject__coll__graph}
\end{center}
\end{figure}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf play\-Object\-Created} ()
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
Arts::Play\-Object {\bf object} ()
\item 
bool {\bf is\-Null} ()
\item 
bool {\bf stream} ()
\item 
void {\bf play} ()
\item 
void {\bf seek} (Arts::po\-Time new\-Time)
\item 
void {\bf pause} ()
\item 
void {\bf halt} ()
\item 
{\bf QString} {\bf description} ()
\item 
Arts::po\-Time {\bf current\-Time} ()
\item 
Arts::po\-Time {\bf overall\-Time} ()
\item 
Arts::po\-Capabilities {\bf capabilities} ()
\item 
{\bf QString} {\bf media\-Name} ()
\item 
Arts::po\-State {\bf state} ()
\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf KDE::Play\-Object\-Factory}\label{classKDE_1_1PlayObject_n0}

\end{CompactItemize}


\subsection{Detailed Description}
This class acts as a general interface to the {\bf KDE} multimedia framework. 

You basically point the Playobject to an URL and say \char`\"{}play\char`\"{}, and it will automatically decode and play and / or display the file or stream. For non-local media, it will make extensive use of KIOInput\-Stream to directly play the content from the remote location without having to download it to a temporary local file first.

A KDE::Play\-Object is never created directly with new, but only through a {\bf KDE::Play\-Object\-Factory}{\rm (p.\,\pageref{classKDE_1_1PlayObjectFactory})}.

Basically, it is used like this: 

\footnotesize\begin{verbatim} KArtsDispatcher dispatcher;
 KArtsServer server;
 KDE::PlayObjectFactory factory( server.server() );
 KDE::PlayObject* playobj = factory.createPlayObject( someURL, true );
 playobj->play();
\end{verbatim}
\normalsize


Internally, the KDE::Play\-Object acts as a wrapper for an Arts::Play\-Object.

Special care needs to be taken for non-local media. In general, you cannot safely figure out the mimetype of the remote media content, by looking at the URL alone. You need to download some data to analyze the content. Since KDE::Play\-Object is only a wrapper for an Arts::Play\-Object, and an Arts::Play\-Object needs to know the mimetype of the data it plays in order to pick the correct decoder, one cannot directly create an Arts::Play\-Object and attach it to a stream. Therefore, the following approach is used.

Whenever a the factory creates a KDE::Play\-Object for a non-local content, it first generates a so called \char`\"{}Proxy\char`\"{} Playobject. This is a KDE::Play\-Object that does not contain a real Arts::Play\-Object yet. As soon as you invoke the {\bf play()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a4})} method, a connection to the media source is made, and as soon as the mimetype is known, the appropriate Arts::Play\-Object is created.

This has some side effects that developers need to be aware of: Until the real Arts::Play\-Object got created,\begin{itemize}
\item the {\bf capabilities()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a11})} method returns \char`\"{}zero\char`\"{} capabilities,\item {\bf description()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a8})} and {\bf media\-Name()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a12})} will return a null {\bf QString},\item {\bf current\-Time()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a9})} and {\bf overall\-Time()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a10})} will return \char`\"{}zero\char`\"{},\item despite the fact that {\bf is\-Null()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a2})} returns \char`\"{}false\char`\"{}, {\bf object()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a1})}.{\bf is\-Null()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a2})} will return \char`\"{}true\char`\"{}. If you need to directly access methods of the internal Arts::Play\-Object, be sure to use {\bf object()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a1})}.{\bf is\-Null()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a2})} to guard your access.\end{itemize}


A KDE::Play\-Object will emit the signal {\bf play\-Object\-Created()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_l0})} as soon as the real internal Arts::Play\-Object got created. This is also true for local media files. So you can generally connect to this signal and act on it if your application needs to know about the real capabilities of the Arts::Play\-Object.

However, KDE::Play\-Object will try to act reasonable on calls to {\bf play()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a4})}, {\bf halt()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a7})}, {\bf pause()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a6})} and {\bf state()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a13})}. If you call {\bf play()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a4})} and then {\bf pause()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a6})} before the connection to the media source was established, it will not start playing once the connection got established. Calling {\bf halt()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a7})} will cancel the connection process. KDE::Play\-Object will maintain an internal state variable, and calling {\bf state()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a13})} will return this internal state until the real Arts::Play\-Object got created, afterwards the state of the Arts::Play\-Object will be returned. 



Definition at line 188 of file kplayobject.h.

\subsection{Member Function Documentation}
\index{KDE::PlayObject@{KDE::Play\-Object}!object@{object}}
\index{object@{object}!KDE::PlayObject@{KDE::Play\-Object}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Arts::Play\-Object KDE::Play\-Object::object ()}\label{classKDE_1_1PlayObject_a1}


Returns the internal Arts::Play\-Object. 



Definition at line 284 of file kplayobject.cc.

Referenced by capabilities(), current\-Time(), description(), halt(), is\-Null(), media\-Name(), overall\-Time(), pause(), play(), seek(), and state().\index{KDE::PlayObject@{KDE::Play\-Object}!isNull@{isNull}}
\index{isNull@{isNull}!KDE::PlayObject@{KDE::Play\-Object}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KDE::Play\-Object::is\-Null ()}\label{classKDE_1_1PlayObject_a2}


return true if this != 0. 

in essence, ((KDE::Play\-Object$\ast$)0)-$>${\bf is\-Null()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a2})} will not crash 

Definition at line 289 of file kplayobject.cc.

References QString::is\-Null(), and object().

Referenced by capabilities(), current\-Time(), description(), halt(), media\-Name(), overall\-Time(), pause(), play(), seek(), and state().\index{KDE::PlayObject@{KDE::Play\-Object}!stream@{stream}}
\index{stream@{stream}!KDE::PlayObject@{KDE::Play\-Object}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KDE::Play\-Object::stream ()}\label{classKDE_1_1PlayObject_a3}


returns \char`\"{}true\char`\"{} if the content to play is delivered as a stream. 



Definition at line 298 of file kplayobject.cc.\index{KDE::PlayObject@{KDE::Play\-Object}!play@{play}}
\index{play@{play}!KDE::PlayObject@{KDE::Play\-Object}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDE::Play\-Object::play ()}\label{classKDE_1_1PlayObject_a4}


causes the {\bf Play\-Object}{\rm (p.\,\pageref{classKDE_1_1PlayObject})} to start the play back. 



Definition at line 173 of file kplayobject.cc.

References endl(), is\-Null(), kd\-Debug(), and object().\index{KDE::PlayObject@{KDE::Play\-Object}!seek@{seek}}
\index{seek@{seek}!KDE::PlayObject@{KDE::Play\-Object}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDE::Play\-Object::seek (Arts::po\-Time {\em new\-Time})}\label{classKDE_1_1PlayObject_a5}


causes the {\bf Play\-Object}{\rm (p.\,\pageref{classKDE_1_1PlayObject})} to skip to the time {\tt new\-Time}. 

You don't need to stop or restart the play back after calling seek.

Definition at line 212 of file kplayobject.cc.

References endl(), is\-Null(), kd\-Debug(), and object().\index{KDE::PlayObject@{KDE::Play\-Object}!pause@{pause}}
\index{pause@{pause}!KDE::PlayObject@{KDE::Play\-Object}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDE::Play\-Object::pause ()}\label{classKDE_1_1PlayObject_a6}


causes the {\bf Play\-Object}{\rm (p.\,\pageref{classKDE_1_1PlayObject})} to pause play back immediately. 

It will not restart until you call {\bf play()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a4})}. This also works on streams, the connection to the media source will be maintained while the {\bf Play\-Object}{\rm (p.\,\pageref{classKDE_1_1PlayObject})} is paused.

Definition at line 222 of file kplayobject.cc.

References is\-Null(), and object().\index{KDE::PlayObject@{KDE::Play\-Object}!halt@{halt}}
\index{halt@{halt}!KDE::PlayObject@{KDE::Play\-Object}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDE::Play\-Object::halt ()}\label{classKDE_1_1PlayObject_a7}


immediately stops the play back and resets the media to the start of the content. 

If playing from a stream, {\bf halt()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a7})} causes the connection to be canceled.

Definition at line 229 of file kplayobject.cc.

References endl(), is\-Null(), kd\-Debug(), and object().\index{KDE::PlayObject@{KDE::Play\-Object}!description@{description}}
\index{description@{description}!KDE::PlayObject@{KDE::Play\-Object}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KDE::Play\-Object::description ()}\label{classKDE_1_1PlayObject_a8}


Reimplemented (Arts::Play\-Object Wrapper). 



Definition at line 242 of file kplayobject.cc.

References QString::from\-Latin1(), is\-Null(), and object().\index{KDE::PlayObject@{KDE::Play\-Object}!currentTime@{currentTime}}
\index{currentTime@{currentTime}!KDE::PlayObject@{KDE::Play\-Object}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Arts::po\-Time KDE::Play\-Object::current\-Time ()}\label{classKDE_1_1PlayObject_a9}


Reimplemented (Arts::Play\-Object Wrapper). 



Definition at line 249 of file kplayobject.cc.

References is\-Null(), and object().\index{KDE::PlayObject@{KDE::Play\-Object}!overallTime@{overallTime}}
\index{overallTime@{overallTime}!KDE::PlayObject@{KDE::Play\-Object}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Arts::po\-Time KDE::Play\-Object::overall\-Time ()}\label{classKDE_1_1PlayObject_a10}


Reimplemented (Arts::Play\-Object Wrapper). 



Definition at line 256 of file kplayobject.cc.

References is\-Null(), and object().\index{KDE::PlayObject@{KDE::Play\-Object}!capabilities@{capabilities}}
\index{capabilities@{capabilities}!KDE::PlayObject@{KDE::Play\-Object}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Arts::po\-Capabilities KDE::Play\-Object::capabilities ()}\label{classKDE_1_1PlayObject_a11}


returns the capabilities of the {\bf Play\-Object}{\rm (p.\,\pageref{classKDE_1_1PlayObject})}. 

The return value is a binary OR of Arts::cap\-Seek and Arts::cap\-Pause, or 0.

Definition at line 263 of file kplayobject.cc.

References is\-Null(), and object().\index{KDE::PlayObject@{KDE::Play\-Object}!mediaName@{mediaName}}
\index{mediaName@{mediaName}!KDE::PlayObject@{KDE::Play\-Object}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KDE::Play\-Object::media\-Name ()}\label{classKDE_1_1PlayObject_a12}


Reimplemented (Arts::Play\-Object Wrapper). 



Definition at line 270 of file kplayobject.cc.

References QString::from\-Latin1(), is\-Null(), and object().\index{KDE::PlayObject@{KDE::Play\-Object}!state@{state}}
\index{state@{state}!KDE::PlayObject@{KDE::Play\-Object}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Arts::po\-State KDE::Play\-Object::state ()}\label{classKDE_1_1PlayObject_a13}


returns the internal state of the {\bf Play\-Object}{\rm (p.\,\pageref{classKDE_1_1PlayObject})}. 

The state can be either Arts::pos\-Idle, Arts::pos\-Paused or Arts::pos\-Playing. A {\bf Play\-Object}{\rm (p.\,\pageref{classKDE_1_1PlayObject})} in state Arts::pos\-Idle is stopped. Once you call {\bf play()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a4})}, the state changes to Arts::pos\-Playing. {\bf pause()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a6})} causes the {\bf Play\-Object}{\rm (p.\,\pageref{classKDE_1_1PlayObject})} to change to Arts::pos\-Paused.

Definition at line 277 of file kplayobject.cc.

References is\-Null(), and object().\index{KDE::PlayObject@{KDE::Play\-Object}!playObjectCreated@{playObjectCreated}}
\index{playObjectCreated@{playObjectCreated}!KDE::PlayObject@{KDE::Play\-Object}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDE::Play\-Object::play\-Object\-Created ()\hspace{0.3cm}{\tt  [signal]}}\label{classKDE_1_1PlayObject_l0}


this signal is emitted as soon as the internal Arts::Play\-Object is created and ready to play. 

It is granted that the Arts::Play\-Object has not started playing, but KDE::Play\-Object will call {\bf object()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a1})}.{\bf play()}{\rm (p.\,\pageref{classKDE_1_1PlayObject_a4})} immediately after emitting this signal, so you need not do it yourself.

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kplayobject.h\item 
kplayobject.cc\end{CompactItemize}
