Bada development: playing real-time rtsp streams

Source: Internet
Author: User
Tags baseuri

Bada is a mobile operating system developed by Samsung. It features flexible configuration, good user interaction, and service-oriented. It attaches great importance to SNS integration and geographic location service applications. Bada is designed to create an era in which everyone can use smartphones. This article describes how to play a real-time rtsp stream on the bada platform.

Use the Osp: Media: Player class

 
 
  1. The supported formats in streaming
  2.  
  3. Video: H.264, H.263, MPEG4
  4.  
  5. Audio: AMR-NB, AAC, AAC +, EAAC +
  6.  
  7. The supported protocol in streaming
  8.  
  9. RTSP
  10.  
  11. {
  12.  
  13.  
  14. _ PPanel = new OverlayPanel ();
  15.  
  16. _ PPanel-> Construct (Rectangle (0, 58, 480,560 ));
  17.  
  18. AddControl (* _ pPanel );
  19.  
  20. _ PPlayer = new Player ();
  21.  
  22. Osp: Graphics: BufferInfo bufferInfo;
  23.  
  24. R = _ pPanel-> GetBackgroundBufferInfo (bufferInfo );
  25.  
  26. _ PListener = new VideoPlayerListener;
  27.  
  28. R = _ pPlayer-> Construct (* _ pListener, & bufferInfo );
  29.  
  30. VideoPlayerPlay ();
  31.  
  32. }
  33.  
  34.  
  35.  
  36. Void
  37.  
  38. VideoPlayerForm: VideoPlayerPlay ()
  39.  
  40. {
  41.  
  42. Result r = E_SUCCESS;
  43.  
  44. If (openFlag = false)
  45.  
  46. {
  47.  
  48. String resolveString (L "rtsp ://***");
  49.  
  50. Uri baseUri;
  51.  
  52. BaseUri. SetUri (resolveString );
  53.  
  54. R = _ pPlayer-> OpenUrl (baseUri );
  55.  
  56. R = _ pPlayer-> Play ();
  57.  
  58. OpenFlag = true;
  59.  
  60. }
  61.  
  62. Else
  63.  
  64. {
  65.  
  66. AppLog ("file being played ");
  67.  
  68. }
  69.  
  70. }
  71.  
  72. // Because Real-Time Streaming Media is played, it is stopped directly when paused, and a connection is established again when it is restored (VideoPlayerPlay () is called ())
  73.  
  74. Void
  75.  
  76. VideoPlayerForm: VideoPlayerPause ()
  77.  
  78. {
  79.  
  80. Result r = E_SUCCESS;
  81.  
  82. PlayerState nowState = _ pPlayer-> GetState ();
  83.  
  84. If (nowState = PLAYER_STATE_PLAYING)
  85.  
  86. {
  87.  
  88. AppLog ("stop ");
  89.  
  90. R = _ pPlayer-> Stop ();
  91.  
  92. If (IsFailed (r ))
  93.  
  94. {
  95.  
  96. AppLog (">>>>>> (VideoPlayer: VideoPlayerStop) Stop has failed: % s \ n", GetErrorMessage (r ));
  97.  
  98. Return;
  99.  
  100. }
  101.  
  102. R = _ pPlayer-> Close ();
  103.  
  104. If (IsFailed (r ))
  105.  
  106. {
  107.  
  108. AppLog (">>>>>> (VideoPlayer: VideoPlayerStop) Close has failed: % s \ n", GetErrorMessage (r ));
  109.  
  110. Return;
  111.  
  112. }
  113.  
  114. OpenFlag = false;
  115.  
  116. }
  117.  
  118. Else
  119.  
  120. {
  121.  
  122. AppLog ("file does not play ");
  123.  
  124. }
  125.  
  126. }

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.