This topic covers how to change the Tizen WASM Player configuration at runtime, and how to handle errors during playback.
Some aspects of a playing stream can be reconfigured during runtime. Changes to following parameters are supported:
Important Configuration 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).
Configuration 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 FPS is a multiple of the old one. Transitions between 30 and 60 FPS are safe, as well as 29.97 and 59.94.
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 FPS is a multiple of the old one. Transitions between 30 and 60 FPS are safe, as well as 29.97 and 59.94.
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:
AppendPacketAsync()
AppendEncryptedPacketAsync()
AppendEndOfTrackAsync()
ElementaryMediaTrackListener
OnAppendError()
class MyMediaElementListener : public samsung::wasm::ElementaryMediaTrackListener { using OperationResult = samsung::wasm::OperationResult; // ... // Override virtual OnAppendError method void OnAppendError(OperationResult result) override { // Handle append error } // ... };
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).
AppendPacket()
The app needs to detect asynchronous errors using HTMLMediaElementListener. The OnError() event must be handled in a custom implementation of HTMLMediaElementListener:
HTMLMediaElementListener
OnError()
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 } // ... };
Important An 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.
An 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.
error_msg