Warning, /frameworks/kmediaplayer/README.md is written in an unsupported language. File is not indexed.
0001 # KMediaPlayer 0002 0003 Interface for media player KParts 0004 0005 ## Introduction 0006 0007 KMediaPlayer builds on the KParts framework to provide a common interface for 0008 KParts that can play media files. 0009 0010 This framework is a porting aid. It is not recommended for new projects, and 0011 existing projects that use it are advised to port away from it, and use plain 0012 KParts instead. 0013 0014 0015 ## Usage 0016 0017 If you are using CMake, you need to have 0018 0019 find_package(KF5MediaPlayer NO_MODULE) 0020 0021 (or similar) in your CMakeLists.txt file, and you need to link any target that 0022 uses KMediaPlayer against KF5::MediaPlayer. 0023 0024 A KPart that wishes to implement this interface must inherit 0025 KMediaPlayer::Player, and indicate in the desktop file that it provides the 0026 KMediaPlayer/Engine service. It may also provide a user interface (by 0027 implementing KMediaPlayer::View), and indicate this by listing the 0028 KMediaPlayer/Player service in the desktop file. 0029 0030 Code needing to make use of this interface can search for relevant KParts with 0031 0032 KService::List offers = 0033 KServiceTypeTrader::self()->query("KMediaPlayer/Player"); 0034 0035 if the GUI is required, or 0036 0037 KService::List offers = 0038 KServiceTypeTrader::self()->query("KMediaPlayer/Engine"); 0039 0040 if not. After checking to see if any services were returned, one can be 0041 instantiated with 0042 0043 KPluginFactory *factory = KPluginLoader(offers.first()).factory(); 0044 if (factory) { 0045 KMediaPlayer::Player part = factory->create<KMediaPlayer::Player>(this); 0046 // use the part 0047 } 0048 0049