2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FMediaPlayer.h
20 * @brief This is the header file for the %Player class.
22 * This header file contains the declarations of the %Player class.
25 #ifndef _FMEDIA_PLAYER_H_
26 #define _FMEDIA_PLAYER_H_
28 #include <FBaseObject.h>
29 #include <FBaseString.h>
30 #include <FBaseUtilUri.h>
31 #include <FBaseByteBuffer.h>
32 #include <FBaseObject.h>
33 #include <FBaseColIMap.h>
34 #include <FGrpBufferInfo.h>
35 #include <FGrpVideoTexture.h>
36 #include <FMediaPlayerTypes.h>
37 #include <FMediaAudioTypes.h>
38 #include <FMediaMediaStreamInfo.h>
39 #include <FMediaAudioManagerTypes.h>
40 #include <FMediaIPlayerEventListener.h>
41 #include <FMediaIPlayerVideoEventListener.h>
42 #include <FMediaIPlayerProgressiveDownloadListener.h>
44 namespace Tizen { namespace Media
49 * @brief This class provides methods to play audio and video.
53 * The %Player class provides methods to play audio and video, including:
54 * - Playing the audio or video content stored in the local storage (internal and external memory).
55 * - Playing the audio or video content stream from the content server over RTSP or HTTP.
56 * - Operating general controls for the audio or video content, such as play, pause, resume, and stop.
57 * - Moving the audio or video content on the basis of time.
58 * - Controlling the volume of the audio or video content.
59 * - Looping the audio or video content.
60 * - Getting the duration of an audio or the video content.
61 * - Playing back multiple audio streams.
63 * The maximum count of the %Player instance is limited by Media::MediaCapability class.
64 * However, the maximum count is a system wide count and it can be practically applied depending on the CPU model, CPU speed, number of CPU cores, CPU load from other applications, and the available memory.
65 * Thus, the exact count can be smaller than the maximum count, in which case the open methods will fail.
70 * @see OpenUrlAsync(const Tizen::Base::String, const Tizen::Base::Collection::IMap*)
71 * @see OpenUrlAsync(const Tizen::Base::String&, const Tizen::Base::String&, IPlayerProgressiveDownloadListener&, const Tizen::Base::Collection::IMap*)
73 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/media/playing_audio.htm">Playing Audio</a> and <a href="../org.tizen.native.appprogramming/html/guide/media/playing_video.htm">Playing Video</a>.
75 * The following example demonstrates how to use the %Player class to play an audio or video file.
79 * #include <FGraphics.h>
84 * using namespace Tizen::Base;
85 * using namespace Tizen::Graphics;
86 * using namespace Tizen::Ui;
87 * using namespace Tizen::Ui::Controls;
88 * using namespace Tizen::Media;
91 * : public Tizen::Ui::Controls::Form
92 * , public Tizen::Media::IPlayerEventListener
93 * , public Tizen::Media::IPlayerVideoEventListener
97 * result StartVideo(void);
98 * result StartAudio(void);
99 * result StartVideoWithVideoEventListener(void);
103 * // IPlayerEventListener
104 * virtual void OnPlayerOpened(result r) {}
105 * virtual void OnPlayerEndOfClip(void) {}
106 * virtual void OnPlayerBuffering(int percent) {}
107 * virtual void OnPlayerErrorOccurred(PlayerErrorReason r) {}
108 * virtual void OnPlayerInterrupted(void) {}
109 * virtual void OnPlayerReleased(void) {}
110 * virtual void OnPlayerSeekCompleted(result r) {}
111 * virtual void OnPlayerAudioFocusChanged (void) {}
113 * // IPlayerVideoEventListener
114 * virtual void OnVideoFrameDecoded(Player &src, BitmapPixelFormat bitmapPixelFormat, const Dimension &dim,
115 * const byte *pBuffer, int sizeOfBuffer, result r);
119 * OverlayRegion *__pOverlay;
122 * PlayerSample::PlayerSample(void)
128 * PlayerSample::StartVideo(void)
130 * result r = E_SUCCESS;
131 * Rectangle rect(0, 0, 320, 240);
132 * BufferInfo bufferInfo;
133 * String filePath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/test.mp4";
135 * // Gets OverlayRegion from this Form
136 * __pOverlay = GetOverlayRegionN(rect, OVERLAY_REGION_TYPE_NORMAL);
137 * if (__pOverlay == null)
139 * return GetLastResult();
142 * __pOverlay->GetBackgroundBufferInfo(bufferInfo);
144 * r = __player.Construct(*this, &bufferInfo);
150 * // Opens file synchronously
151 * r = __player.OpenFile(filePath, false);
157 * __player.SetLooping(true);
158 * __player.SetVolume(80);
160 * r = __player.Play();
175 * PlayerSample::StartAudio(void)
177 * result r = E_SUCCESS;
178 * String filePath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/test.mp3";
180 * r = __player.Construct(*this);
186 * // Opens file synchronously
187 * r = __player.OpenFile(filePath, false);
193 * __player.SetVolume(80);
195 * r = __player.Play();
205 * PlayerSample::Stop(void)
218 * PlayerSample::StartVideoWithVideoEventListener(void)
220 * result r = E_SUCCESS;
221 * Rectangle rect(0, 0, 320, 240);
222 * String filePath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/test.mp4";
224 * r = __player.Construct(*this, *this);
230 * r = __player.OpenFile(filePath);
236 * // Gets OverlayRegion from this Form
237 * __pOverlay = GetOverlayRegionN(rect, OVERLAY_REGION_TYPE_NORMAL);
238 * if (__pOverlay == null)
240 * return GetLastResult();
243 * r = __player.Play();
261 * PlayerSample::OnVideoFrameDecoded(Player &src, BitmapPixelFormat bitmapPixelFormat, const Dimension &dim,
262 * const byte *pBuffer, int sizeOfBuffer, result r)
265 * OverlayRegionBufferPixelFormat overlayPixelFormat;
272 * if (__pOverlay == null)
277 * if (bitmapPixelFormat == BITMAP_PIXEL_FORMAT_ARGB8888)
279 * overlayPixelFormat = OVERLAY_REGION_BUFFER_PIXEL_FORMAT_ARGB8888;
281 * else if (bitmapPixelFormat == BITMAP_PIXEL_FORMAT_RGB565)
283 * overlayPixelFormat = OVERLAY_REGION_BUFFER_PIXEL_FORMAT_RGB565;
285 * else // Unsupported pixel format
290 * buf.Construct(pBuffer, 0, sizeOfBuffer, sizeOfBuffer);
291 * __pOverlay->SetInputBuffer(buf, dim, overlayPixelFormat);
298 class _OSP_EXPORT_ Player
299 : public Tizen::Base::Object
303 * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
311 * This destructor overrides Tizen::Base::Object::~Object(). @n
312 * This method deallocates the resources. This method must be called in the same thread as the Construct()
318 virtual ~Player(void);
322 * Initializes this instance of %Player with the specified parameters.
326 * @return An error code
327 * @param[in] listener An instance of IPlayerEventListener
328 * @param[in] pBufferInfo The buffer information to display the video @n
329 * This information is essential to play a video but not required for an audio content.
330 * @exception E_SUCCESS The method is successful.
331 * @exception E_SYSTEM A system error has occurred.
332 * @exception E_OUT_OF_MEMORY The memory is insufficient.
333 * @exception E_RESOURCE_UNAVAILABLE The player's resources are unavailable.
334 * @remarks Multiple instances of %Player can be constructed.
336 result Construct(IPlayerEventListener& listener, const Tizen::Graphics::BufferInfo* pBufferInfo = null);
339 * Opens an audio or video file to be played. @n
340 * The %OpenFile() method works synchronously, but when the second parameter, @c isAsync is set to @c true, this method works asynchronously.
341 * Note that a method that works asynchronously must implement a listener.
344 * @brief <i> [Compatibility] </i>
348 * @compatibility This method has compatibility issues with %Tizen API versions@n
349 * For more information, see @ref CompIoPathPage "here".
352 * @return An error code
353 * @param[in] mediaLocalPath The local file path of the media source
354 * @param[in] isAsync Set to @c true for the asynchronous mode, @n
355 * else @c false for the synchronous mode
356 * @exception E_SUCCESS The method is successful.
357 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
358 * @exception E_SYSTEM A system error has occurred.
359 * @exception E_FILE_NOT_FOUND The specified file cannot be found or accessed.
360 * @exception E_INVALID_DATA The specified file contains invalid data.
361 * @exception E_OUT_OF_MEMORY The memory is insufficient.
362 * @exception E_UNSUPPORTED_FORMAT The given content format is not supported.
363 * @exception E_RIGHT_EXPIRED The content right has expired.
364 * @exception E_RIGHT_NO_LICENSE The content has no license.
365 * @exception E_RIGHT_FUTURE_USE The content right is for future use.
366 * @exception E_DISPLAY_RIGHT_VIOLATED The display right is not valid for the specific output device. @b Since: @b 2.1
367 * @remarks This method returns E_SYSTEM when the device runs out of system resources.
370 result OpenFile(const Tizen::Base::String& mediaLocalPath, bool isAsync = false);
373 * Opens an audio or video streaming content to play through the specified URL. @n
374 * The %OpenUrl() method works synchronously, but when the second parameter @c isAsync is set to @c true,
375 * this method works asynchronously. Note that a method that works asynchronously must implement a listener.
379 * @return An error code
380 * @param[in] mediaUri The URI of the media source
381 * @param[in] isAsync Set to @c true for the asynchronous mode, @n
382 * else @c false for the synchronous mode
383 * @exception E_SUCCESS The method is successful.
384 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
385 * @exception E_CONNECTION_FAILED The network connection has failed.
386 * @exception E_UNSUPPORTED_PROTOCOL The protocol is not supported.
387 * @exception E_SYSTEM A system error has occurred.
388 * @exception E_FILE_NOT_FOUND The remote file cannot be found or accessed.
389 * @exception E_UNSUPPORTED_FORMAT The given content format is not supported.
390 * @exception E_RIGHT_EXPIRED The content right has expired.
391 * @exception E_RIGHT_NO_LICENSE The content has no license.
392 * @exception E_RIGHT_FUTURE_USE The content right is for future use.
393 * @exception E_DISPLAY_RIGHT_VIOLATED The display right is not valid for the specific output device. @b Since: @b 2.1
395 * - This method is not thread-safe when @c isAsync is @c false.
396 * - Input URL should be encoded if there are non-alphanumeric characters in URL.
397 * - This method returns E_SYSTEM when the device runs out of system resources.
400 result OpenUrl(const Tizen::Base::Utility::Uri& mediaUri, bool isAsync = false);
403 * Opens an audio or video content to play on the memory. @n
404 * The %OpenBuffer() method works synchronously, but when the second parameter @c isAsync is set to @c true, this method works asynchronously.
405 * Note that a method that works asynchronously must implement a listener.
409 * @return An error code
410 * @param[in] mediaBuffer A pointer to the media source in the external memory
411 * @param[in] isAsync Set to @c true for asynchronous mode, @n
412 * else @c false for synchronous mode
413 * @exception E_SUCCESS The method is successful.
414 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
415 * @exception E_SYSTEM A system error has occurred.
416 * @exception E_OBJ_NOT_FOUND The specified media buffer cannot be found.
417 * @exception E_INVALID_DATA The specified buffer contains invalid data.
418 * @exception E_OUT_OF_MEMORY The memory is insufficient.
419 * @exception E_UNSUPPORTED_FORMAT The given content format is not supported.
420 * @exception E_RIGHT_EXPIRED The content right has expired.
421 * @exception E_RIGHT_NO_LICENSE The content has no license.
422 * @exception E_RIGHT_FUTURE_USE The content right is for future use.
423 * @exception E_DISPLAY_RIGHT_VIOLATED The display right is not valid for the specific output device. @b Since: @b 2.1
424 * @remarks This method returns E_SYSTEM when the device runs out of system resources.
427 result OpenBuffer(const Tizen::Base::ByteBuffer& mediaBuffer, bool isAsync = false);
430 * Closes the audio or video content. @n
431 * The %Close() method works synchronously.
435 * @return An error code
436 * @exception E_SUCCESS The method is successful.
437 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
438 * @exception E_SYSTEM A system error has occurred.
446 * Plays the audio or video content. @n
447 * The playback starts from the current position. In case of the ::PLAYER_STATE_ENDOFCLIP player state, the audio or video content
452 * @return An error code
453 * @exception E_SUCCESS The method is successful.
454 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
455 * @exception E_DEVICE_BUSY The device cannot be approached because of other operations.
456 * @exception E_UNSUPPORTED_FORMAT The specified format is not supported.
457 * @exception E_UNSUPPORTED_CODEC The specified codec is not supported.
458 * @exception E_SYSTEM A system error has occurred. @n
459 * If playback has been paused, it resumes from the last position. @n
460 * @c E_SYSTEM is returned when unsupported format or codec media data are received during streaming. @n
461 * @c E_SYSTEM is returned when the unsupport resolution is set for rendering .
462 * @remarks When this method is called after the %Player instance is created with the Construct() method that accepts the IPlayVideoEventListener
463 * interface as a parameter, it delivers every video frame of a video content continuously until the state is changed to ::PLAYER_STATE_ENDOFCLIP,
464 * or the Stop() or Pause() method is called .
467 * @see IPlayerVideoEventListener
472 * Stops the playback of the audio or video content. @n
473 * The %Stop() method works synchronously.
477 * @return An error code
478 * @exception E_SUCCESS The method is successful.
479 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
480 * @exception E_SYSTEM A system error has occurred.
481 * @remarks In the Real Time Streaming Protocol (RTSP), this method stops the media stream and requests the termination of the network session.
488 * Pauses the playback of the audio or video content. @n
489 * To resume the playback, the Play() method must be called. The %Pause() method works synchronously.
493 * @return An error code
494 * @exception E_SUCCESS The method is successful.
495 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
496 * @exception E_SYSTEM A system error has occurred.
503 * Gets the state of an audio or video player.
507 * @return The current state of the player
514 PlayerState GetState(void) const;
517 * Gets the time for the current playback position of the audio or video content. @n
518 * Accuracy of the retrieved time is determined by the subsystem (for example, the time slice of the OS scheduler,
519 * time resolution of the audio or video codec, or implementation of the audio or video player).
520 * Note that it must not be assumed that the %GetPosition() method can reach the exact position mentioned by GetDuration().
524 * @return The current position of the player in milliseconds
525 * @exception E_SUCCESS The method is successful.
526 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
528 * - The specific error code can be accessed using the GetLastResult() method.
529 * - This method returns @c -1 when the method fails.
532 long GetPosition(void) const;
535 * Seeks the current playback position of the audio or video content to the specified time. @n
536 * The %SeekTo() method works asynchronously. @n
537 * Note that a method that works asynchronously must implement a listener. @n
538 * This method only works for the ::PLAYER_STATE_PLAYING, ::PLAYER_STATE_PAUSED, and ::PLAYER_STATE_OPENED states of the player. @n
539 * This method changes the playback position as well as the time value. @n
540 * In video, it may not change position accurately.
544 * @return An error code
545 * @param[in] msTime The time in milliseconds to move to the current playback position @n
546 * @c 0 indicates the starting position.
547 * @exception E_SUCCESS The method is successful.
548 * @exception E_INVALID_STATE This instance is in an invalid state for this method. @n
549 * While playing live streaming, this operation returns @c E_INVALID_STATE. @n
550 * This method returns @c E_INVALID_STATE, if this method is called again before
551 * IPlayerEventListener::OnPlayerSeekCompleted() is called.
552 * @exception E_OUT_OF_RANGE The specified time is out of range.
553 * @exception E_INVALID_DATA The media data is inappropriate for seeking.
554 * @exception E_SYSTEM A system error has occurred.
555 * @remarks For video, this method delivers one video frame on the specified position through the video
556 * event. Before calling this method, the %Player instance must be created with the Construct()
557 * method has a parameter of the IPlayVideoEventListener interface .
559 * @see IPlayerVideoEventListener
561 result SeekTo(long msTime);
564 * Gets the total running time of the media source.
568 * @return The running time of the media source in milliseconds
569 * @exception E_SUCCESS The method is successful.
570 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
572 * - The specific error code can be accessed using the GetLastResult() method.
573 * - While playing live streaming, this operation returns @c 0.
574 * - This method is valid in the ::PLAYER_STATE_OPENED, ::PLAYER_STATE_PLAYING, ::PLAYER_STATE_PAUSED, and ::PLAYER_STATE_STOPPED states of this instance.
575 * - This method returns @c -1 when the method fails.
578 long GetDuration(void) const;
581 * Sets the specified value for the volume of an audio or video player.
585 * @return An error code
586 * @param[in] volume The new value of volume @n
587 * The range of this parameter is @c 0 to @c 100 and it is proportional to the current media sound volume level in setting.
588 * @exception E_SUCCESS The method is successful.
589 * @exception E_OUT_OF_RANGE The specified @c volume is out of range.
590 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
594 * @remarks If an application wants to start a playback of the media content with the given audio sound, this method should be called before calling the Open methods.
595 * This is because the initial audio packet is not applied as the given audio volume if this method is called after the open methods have been called.
597 result SetVolume(int volume);
600 * Gets the current volume of an audio or video player.
604 * @return The current volume level @n
605 * The range of this return value is @c 0 to @c 100.
610 int GetVolume(void) const;
613 * Sets the mute status of an audio or video player.
617 * @return An error code
618 * @param[in] mute Set to @c true to mute the audio or video player, @n
620 * @exception E_SUCCESS The method is successful.
621 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
625 * @remarks If an application wants to start a playback of the media content without any sound, this method should be called before calling the Open methods.
626 * This is because the initial audio packet is not applied as the given audio volume if this method is called after the open methods have been called.
628 result SetMute(bool mute);
631 * Checks the mute status of an audio or video player.
635 * @return @c true if the audio or video player is muted, @n
641 bool IsMuted(void) const;
644 * Sets an audio or video player to be in a loop. @n
645 * Sets the looping to @c true to continuously play the audio or video content.
649 * @return An error code
650 * @param[in] looping Set to @c true to play the audio or video content in a loop, @n
652 * @exception E_SUCCESS The method is successful.
653 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
654 * @remarks In streaming, this method throws @c E_INVALID_STATE for the cost of network.
657 result SetLooping(bool looping);
660 * Checks whether the audio or video player is in a loop.
664 * @return @c true if the audio or video player is in a loop, @n
668 bool IsLooping(void) const;
671 * Gets the current media stream information.
675 * @return A pointer to the MediaStreamInfo instance containing metadata for the current media stream
676 * @exception E_SUCCESS The method is successful.
677 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
678 * @exception E_INVALID_CONTENT The content is inappropriate to compose media stream information.
679 * @exception E_SYSTEM A system error has occurred.
681 * - This method returns a stream information of the media, which is currently being opened.
682 * - The specific error code can be accessed using the GetLastResult() method.
683 * - This method is valid in the ::PLAYER_STATE_OPENED, ::PLAYER_STATE_PLAYING, ::PLAYER_STATE_PAUSED, and ::PLAYER_STATE_STOPPED states of this instance.
685 MediaStreamInfo* GetCurrentMediaStreamInfoN(void) const;
688 * Sets the rendering buffer for the video playback.
692 * @return An error code
693 * @param[in] bufferInfo The buffer information to display the video
694 * @exception E_SUCCESS The method is successful.
695 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
696 * @exception E_INVALID_ARG The specified input parameter is invalid.
697 * @exception E_SYSTEM A system error has occurred. @n
698 * E_SYSTEM is returned when the unsupport resolution is set for rendering .
700 * - This method works for the ::PLAYER_STATE_OPENED, ::PLAYER_STATE_ENDOFCLIP, ::PLAYER_STATE_STOPPED,
701 * ::PLAYER_STATE_PAUSED, and ::PLAYER_STATE_PLAYING states of the player.
702 * - This method throws @c E_INVALID_STATE after the player instance is constructed with IPlayerVideoEventListener.
704 result SetRenderingBuffer(const Tizen::Graphics::BufferInfo& bufferInfo);
707 * Initializes this instance of %Player with the specified parameters.
711 * @return An error code
712 * @param[in] listener An IPlayerEventListener instance
713 * @param[in] videoListener An IPlayerVideoEventListener instance
714 * @exception E_SUCCESS The method is successful.
715 * @exception E_SYSTEM A system error has occurred.
716 * @exception E_RESOURCE_UNAVAILABLE The player's resources are unavailable.
717 * @exception E_OUT_OF_MEMORY The memory is insufficient.
718 * @remarks This method constructs the %Player instance to render the video content into the buffer of the video event listener.
720 result Construct(IPlayerEventListener& listener, IPlayerVideoEventListener& videoListener);
723 * Captures the video frame. @n
724 * The %CaptureVideo() method delivers one video frame of a video content by using the IPlayVideoEventListener interface only once in the %Player instance. @n
725 * This method works only for the ::PLAYER_STATE_OPENED state of the %Player instance, and the state of the %Player instance is changed to
726 * ::PLAYER_STATE_PAUSED from @c PLAYER_STATE_OPENED after calling this method.
730 * @return An error code
731 * @exception E_SUCCESS The method is successful.
732 * @exception E_INVALID_STATE This instance is in an invalid state for this method. @n
733 * This method throws @c E_INVALID_STATE if the %Player instance is
734 * constructed without IPlayerVideoEventListener.
735 * @exception E_INVALID_OPERATION This method is invalid for the current media content.
736 * @exception E_SYSTEM A system error has occurred.
737 * @remarks In the Real Time Streaming Protocol (RTSP), this method does not work properly.
738 * The application must wait till the invocation of IPlayerVideoEventListener::OnVideoFrameDecoded() callback from framework for proper functioning.
740 result CaptureVideo(void);
743 * Sets the audio stream type.
747 * @return An error code
748 * @param[in] type An audio stream type
749 * @exception E_SUCCESS The method is successful.
750 * @exception E_INVALID_ARG The specified input parameter is invalid.
751 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
753 * - This method works for the ::PLAYER_STATE_INITIALIZED or ::PLAYER_STATE_CLOSED states of the %Player instance.
754 * - In other states of %Player instance, this method returns @c E_SUCCESS, but the audio stream type is not changed properly.
756 result SetAudioStreamType(AudioStreamType type);
759 * Opens an audio or video streaming content to play through the specified URL with the HTTP header. @n
760 * The %OpenUrlAsync() method works asynchronously, thus application can call further methods of %Player after IPlayerEventListener::OnPlayerOpened() is called.
764 * @return An error code
765 * @param[in] url The URL of the media source
766 * @param[in] pHeader The list of field and value pairs that will be added in HTTP request header. @n
767 The types of field and value are described in the Programming Guide. If @c null, then default values will be set.
769 * @exception E_SUCCESS The method is successful.
770 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
771 * @exception E_UNSUPPORTED_PROTOCOL The protocol is not supported.
772 * @exception E_INVALID_ARG A specified input parameter is invalid.
773 * @exception E_OUT_OF_MEMORY The memory is insufficient.
774 * @remarks See Programming Guide for the detail information of supported HTTP header fields.
777 result OpenUrlAsync(const Tizen::Base::String& url, const Tizen::Base::Collection::IMap* pHeader = null);
780 * Opens an audio or video streaming content to play through the specified HTTP URL with the HTTP header for the progressive download playback. @n
781 * The %OpenUrlAsync() method works asynchronously, thus application can call further methods of %Player after IPlayerEventListener::OnPlayerOpened() is called.
782 * The content information of the media source must be located at the beginning of the file for the progressive download playback. Otherwise, it does not guarantee to play and download media stream properly.
786 * @return An error code
787 * @param[in] url The URL of the media source
788 * @param[in] filePath The file path on local file system where the downloaded content will be saved
789 * @param[in] listener The download listener
790 * @param[in] pHeader The list of field and value pairs that will be added in HTTP request header @n
791 * The types of field and value are described in the Programming Guide.
792 * If @c null, then default values will be set.
793 * @exception E_SUCCESS The method is successful.
794 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
795 * @exception E_UNSUPPORTED_PROTOCOL The protocol is not supported.
796 * @exception E_INVALID_ARG A specified input parameter is invalid.
797 * @exception E_OUT_OF_MEMORY The memory is insufficient.
799 * - The download will start when Play() is called.
800 * - If the specified file name already exists, then the old file will be overwritten with the new one.
801 * - See Programming Guide for the detail information of supported HTTP header fields.
804 result OpenUrlAsync(const Tizen::Base::String& url, const Tizen::Base::String& filePath, IPlayerProgressiveDownloadListener& listener, const Tizen::Base::Collection::IMap* pHeader = null);
808 * Sets the interval of calling the progress event.
812 * @param[in] percent The progress period interval as a percentage value
814 * - If the server does not provide the information about the content size, progress event will occur randomly.
815 * - If the percentage value is not set, @c 10 will be set as a default value.
816 * @see IPlayerProgressiveDownloadListener::OnPlayerProgressiveDownloadInProgress()
818 void SetProgressiveDownloadIntervalByPercent(int percent);
821 * Initializes this instance of %Player with the specified parameters.
825 * @return An error code
826 * @param[in] listener An IPlayerEventListener instance
827 * @param[in] videoTexture An VideoTexture instance
828 * @exception E_SUCCESS The method is successful.
829 * @exception E_INVALID_ARG A specified input parameter is invalid.
830 * @exception E_RESOURCE_UNAVAILABLE The player's resources are unavailable.
831 * @exception E_OUT_OF_MEMORY The memory is insufficient.
832 * @remarks This method constructs the %Player instance to render the video content into the video texture area.
834 result Construct(IPlayerEventListener& listener, Tizen::Graphics::Opengl::VideoTexture& videoTexture);
837 * Gets the current downloading progress of HTTP streaming playback in percent.
841 * @return The current position in percent
842 * @exception E_SUCCESS The method is successful.
843 * @exception E_INVALID_OPERATION The operation cannot be processed further as the media is not in the HTTP streaming playback format.
844 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
846 * - This method works only for the ::PLAYER_STATE_PLAYING or ::PLAYER_STATE_PAUSED states of the %Player instance.
847 * - This method is not supported in HTTP Live Streaming.
848 * - The specific error code can be accessed using GetLastResult() method.
849 * - This method returns @c -1 when the method fails.
851 int GetHttpStreamingDownloadProgress(void) const;
854 * Seeks the current playback position of the video content to the nearest key frame at the specified time if the content
855 * contains key frames.
856 * The %SeekVideoKeyFrameCloseTo() method works asynchronously with the IPlayerEventListener::OnPlayerSeekCompleted() method.
859 * @return An error code
860 * @param[in] msTime The time in milliseconds to move to the current playback position
861 * @c 0 indicates the starting position.
862 * @exception E_SUCCESS The method is successful
863 * @exception E_INVALID_STATE The given instance is in an invalid state for this method. @n
864 * While playing live streaming, this operation returns @c E_INVALID_STATE. @n
865 * This method returns @c E_INVALID_STATE, if this method is called again before
866 * IPlayerEventListener::OnPlayerSeekCompleted) is called.
867 * @exception E_OUT_OF_RANGE The specified time is out of range
868 * @exception E_INVALID_DATA The media data is inappropriate for seeking.
870 * - This method only works for the PLAYER_STATE_PLAYING, PLAYER_STATE_PAUSED, and PLAYER_STATE_OPENED states of the player instance.
871 * - This method is not guaranteed to work correctly when the content does not have key frames.
872 * - This method is faster than SeekTo() but the seeking accuracy is worse than %SeekTo().
874 result SeekVideoKeyFrameCloseTo(long msTime);
879 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
883 Player(const Player& rhs);
886 *The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
890 Player& operator =(const Player& rhs);
892 friend class _PlayerImpl;
893 class _PlayerImpl* __pPlayerImpl;