Skip to main content
Version: 7.3.2

LiveMediaPlayer

API Reference: UI.LiveMediaPlayer

LiveMediaPlayer is a live streaming viewer based on NoMediaClient library. It is used for audio and video playback in RTMP/RTMPT/RTSP/HTTP/TCP/UDP/FILE format.

Original iOS library: https://github.com/NodeMedia/NodeMediaClient-iOS
Original Android library: https://github.com/NodeMedia/NodeMediaClient-Android

LiveMediaPlayer Event Callback

You can listen the changes using onChange callback. Events are listed below.

LiveMediaPlayer Events

  • 1000: Connecting to video
  • 1001: Video connection successful
  • 1002: If the video connection fails, it will automatically reconnect.
  • 1003: The video starts to reconnect
  • 1004: End of the video playback
  • 1005: If the network is abnormal during video playback, it will automatically reconnect.
  • 1006: When the network connection times out, it will automatically reconnect.
  • 1100: The play buffer is empty.
  • 1101: The playback buffer is buffering data.
  • 1102: When the playback buffer reaches the bufferTime setting value, playback starts.
  • 1103: Received RTMP protocol stream EOF. It will automatically reconnect.
  • 1104: After decoding, the height and width of the video are obtained.
note

The components in the example are added from the code for better showcase purposes. To learn more about the subject you can refer to:

Adding Component From Code

As a best practice, Smartface recommends using the WYSIWYG editor in order to add components and styles to your page or library. To learn how to use UI Editor better, please refer to this documentation

UI Editor Basics
.ui/pgMediaPlayer.pgx
{
"components": [
{
"className": ".page",
"id": "df2a-1527-309d-ab7e",
"initialized": true,
"props": {
"children": [
"a668-8e81-434e-6681",
"95bf-507e-ec77-0a7a",
"5a00-8ca7-3153-0fbc",
"b55a-3417-25b5-1038",
"f594-152c-8a98-27bb"
],
"name": "pgLiveMediaPlayer",
"orientation": "PORTRAIT",
"parent": null
},
"type": "Page",
"userProps": {},
"version": "0.0.1.a"
},
{
"className": ".statusBar",
"id": "a668-8e81-434e-6681",
"props": {
"children": [],
"isRemovable": false,
"name": "statusBar",
"parent": "df2a-1527-309d-ab7e"
},
"type": "StatusBar",
"userProps": {}
},
{
"className": ".headerBar",
"id": "95bf-507e-ec77-0a7a",
"props": {
"children": [],
"isRemovable": false,
"name": "headerBar",
"parent": "df2a-1527-309d-ab7e",
"title": "LiveMediaPlayer"
},
"type": "HeaderBar",
"userProps": {
"title": "LiveMediaPlayer"
}
},
{
"className": ".flexLayout",
"id": "5a00-8ca7-3153-0fbc",
"oldName": "flexLayout1",
"props": {
"children": [],
"name": "flLiveMediaPlayer",
"parent": "df2a-1527-309d-ab7e",
"usePageVariable": true
},
"type": "FlexLayout",
"userProps": {
"usePageVariable": true
}
},
{
"className": ".button",
"id": "b55a-3417-25b5-1038",
"oldName": "button1",
"props": {
"children": [],
"name": "btnAction",
"parent": "df2a-1527-309d-ab7e",
"text": "Play",
"usePageVariable": true
},
"type": "Button",
"userProps": {
"text": "Play",
"usePageVariable": true
}
},
{
"className": ".button",
"id": "f594-152c-8a98-27bb",
"oldName": "btn",
"props": {
"children": [],
"name": "btnPause",
"parent": "df2a-1527-309d-ab7e",
"text": "Pause",
"usePageVariable": true
},
"type": "Button",
"userProps": {
"text": "Pause",
"usePageVariable": true
}
}
]
}