This topic covers how to change the Tizen WASM Player configuration at runtime, and how to handle errors during playback.
Changing Runtime Configuration
Some aspects of a playing stream can be reconfigured during runtime. Changes to following parameters are supported:
Track type
Parameter
Video
Resolution
Video
Frame rate
ImportantConfiguration changes must always happen on a keyframe. Depending on the codec in use, there can be additional requirements regarding the packet that triggers runtime reconfiguration (for example, a h264 packet may be required to contain PPS NAL).
To change specific runtime configurations, send a keyframe packet that has the new configuration value set:
To change the stream resolution:
ElementaryMediaPacket packet;
// ...
packet.width = /* New width */;
packet.height = /* New height */;
// ...
To change the stream framerate:
ElementaryMediaPacket packet;
// ...
packet.framerate_num = /* New framerate_num */;
packet.framerate_den = /* New framerate_den */;
// ...
Important
The data payload of the packet must contain appropriate initialization data for the new configuration, depending on the codec that is currently in use.
To avoid video glitches, it is recommended that the new frame rate is a multiple of the old one. Transitions between 30fps and 60fps are safe, as well as 29.97fps and 59.94fps.
Handling Async Append Errors
If AppendPacketAsync(), AppendEncryptedPacketAsync(), or AppendEndOfTrackAsync() are used, the app must detect async append errors using ElementaryMediaTrackListener. The OnAppendError() event should be handled in a custom implementation of ElementaryMediaTrackListener:
class MyMediaElementListener : public samsung::wasm::ElementaryMediaTrackListener {
using OperationResult = samsung::wasm::OperationResult;
// ...
// Override virtual OnAppendError method
void OnAppendError(OperationResult result) override {
// Handle append error
}
// ...
};
Handling Pipeline Errors
The platform multimedia pipeline runs asynchronously. Elementary media packets are moved through the pipeline and processed after the AppendPacket() operation is finished. The WASM Player verifies as much data as feasible when its API is called, however some errors can still happen asynchronously (such as decoding errors).
The app needs to detect asynchronous errors using HTMLMediaElementListener. The OnError() event must be handled in a custom implementation of HTMLMediaElementListener:
class MyMediaElementListener : public samsung::html::HTMLMediaElementListener {
using MediaError = samsung::html::MediaError;
// ...
// Override virtual OnError method
void OnError(MediaError error_code, const char* error_msg) override {
// Handle media error
}
// ...
};
ImportantAn ownership of error_msg is not transferred and the pointer is valid only for the duration of the OnError() call. Do not free this pointer manually.
Manage Your Cookies
We use cookies to improve your experience on our website and to show you relevant
advertising. Manage you settings for our cookies below.
Essential Cookies
These cookies are essential as they enable you to move around the website. This
category cannot be disabled.
Company
Domain
Samsung Electronics
.samsungdeveloperconference.com
Analytical/Performance Cookies
These cookies collect information about how you use our website. for example which
pages you visit most often. All information these cookies collect is used to improve
how the website works.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Functionality Cookies
These cookies allow our website to remember choices you make (such as your user name, language or the region your are in) and
tailor the website to provide enhanced features and content for you.
Company
Domain
LinkedIn
.ads.linkedin.com, .linkedin.com
Advertising Cookies
These cookies gather information about your browser habits. They remember that
you've visited our website and share this information with other organizations such
as advertisers.
Company
Domain
LinkedIn
.linkedin.com
Meta (formerly Facebook)
.samsungdeveloperconference.com
Google Inc.
.samsungdeveloperconference.com
Preferences Submitted
You have successfully updated your cookie preferences.