Commit Graph

33 Commits

Author SHA1 Message Date
Jøger Hansegård 9d7ff8c111 Switch media player audio output when OS default audio output changes
This patch allows the user to change the audio device while a video or
audio file is being played in the media player app.

Before this change, audio would start playing on operating system's
default audio device, but it would not switch to another audio device
even if the user selected another device while the media was playing.

This patch uses a MediaDevices QML element to listen to audio device
changes from the operating system, and will automatically switch to the
device that is set as default at any time.

Fixes: QTBUG-119282
Pick-to: 6.8
Change-Id: Id1acfe9e9025a81c4cc3fa0e4593292f287f7b9a
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
2024-11-13 12:02:34 +01:00
Jøger Hansegård 4215c9afec Rename media player image file to avoid name clash with QtScXml example
Qt Multimedia's media player, and QtScXml's media player used the same
mediaplayer.png filename on their respective application screenshot,
which caused the QtScXml example image to incorrectly be used with the
Qt Multimedia example.

Renaming the media player image from mediaplayer.png to
mediaplayerapp.png. This way the filename matches the CMake target name
for the application.

Fixes: QTBUG-129444
Pick-to: 6.8 6.7
Change-Id: Ie4d93d2cc5100a42faeec7828775b62a56d3ff23
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2024-09-28 12:24:01 +02:00
Timur Pocheptsov a0885c2cdd MediaPlayerApp: add FFmpeg libraries embedding on iOS
As it was previously done for qtmultimedia's examples.

Pick-to: 6.8 6.8.0
Change-Id: I244e531e722c86632a713999a4762fc1dd17e50b
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
2024-09-26 04:28:11 +02:00
Friedemann Kleint dbd33f139b Fix mediaplayer to work with Python
Adapt the Python code to qtdoc/
96ee261e6b.

Task-number: QTBUG-122273
Pick-to: 6.7
Change-Id: Ibe92481ffff21ce1de0c6804548d76fcc8587688
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
2024-05-27 08:39:05 +02:00
Alexandru Croitor cde9cfb96c CMake: Add deployment API to our examples
Projects were modified using the tool at:
https://git.qt.io/alcroito/cmake_refactor

Some examples had to be adapted manually, mostly those that build
additional qml modules / plugins.

documentviewer did not get the deployment api, because it's trickier.

Pick-to: 6.7
Task-number: QTBUG-101340
Task-number: QTBUG-102056
Task-number: QTBUG-102057
Change-Id: I76322185fc824c112d77e077ee39e7ccbc193a4c
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-05-13 09:44:04 +02:00
Bartlomiej Moskal 252e19f0c7 MediaPlayer demo: Add FileNameProvider for PlayList
There is an issue on Android where QFileDialog does not return real
filenames. Instead, it returns content URIs that do not seem appropriete
for displaying in playlist.

To ensure that filenames are displayed correctly, we need to use
QFileInfo. Since there is no QML type for QFileInfo, additional
FileNameProvider singleton type has been registered for QML use.

Fixes: QTBUG-122273
Pick-to: 6.7 6.5
Change-Id: Ib6bd152856a6979788bcbb203d58a38810ea0682
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2024-04-16 18:19:34 +00:00
Mikko Hallamaa c5e047f5c7 MediaPlayer: Remove restrictions of protocols in URL
The URL input field had a validation that limited the possible protocols
to only http, https, rtp, rtsp and udp.

This patch modifies the validation regular expression to allow for more
protocols supported by FFmpeg.

Pick-to: 6.7
Change-Id: I84861673a78d4317592f96b4a92d8e676b05660f
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
2024-03-21 10:05:56 +01:00
Mikko Hallamaa 8e97daa0ca MediaPlayer: Add return type annotation to validateUrl
Add return type annotation to validateUrl() function to get rid of a
warning when running the MediaPlayer demo.

Pick-to: 6.7
Change-Id: I2e0ac48f111e90d37d46dc8cd39adb3bcd228ca5
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
2024-03-14 10:23:46 +01:00
Mikko Hallamaa 5eb9a602dc MediaPlayer: Use theme colors in menu
MediaPlayer demo was using themed text colors but native base colors in
the File menu. This caused issues with visibility if the contrast
between the colors was too low, at least on Gnome.

This patch updates the demo to use themed colors in the File menu, as
well as using the highlight color more appropriately for better
visibility in both dark and light themes.

Additionally, the highlight color is added to the theming singleton.

Pick-to: 6.7
Change-Id: I7baf0ce217e24112c8daabfdeec76e069c867062
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
2024-03-12 12:50:20 +01:00
Timur Pocheptsov ee7725862f MediaPlayerApp example - avoid infinite looping
If we have only 1 file and trying to shuffle, we enter an infinite
loop, while trying to find an index not equal to the current one.
We need an additional check to avoid this.

Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-122178
Change-Id: I299ef0f66adc271be5921a6f16eabde9b2021499
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io>
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
2024-03-01 11:28:39 +01:00
Mikko Hallamaa 2b714d357d MediaPlayer example: Fix scrolling of track options
The MediaPlayer demo had an issue in the track options list where nested
scrolling caused some options to be difficult to access.

This is fixed by positioning all track options in a Column instead of a
ListView.

Additionally modified the TracksOptions implicit height binding to size
the component based on the amount of options.

Fixes: QTBUG-119285
Pick-to: 6.7 6.6
Change-Id: Iaa1ed2c370118a5c0119b233a59c7f4d8c0c70eb
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Lars Sutterud <lars.sutterud@qt.io>
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
2024-01-31 09:46:07 +01:00
Samuli Piippo 22315147d0 CMake: fix installation of demos projects
Projects need install instructions to be usable on embedded platforms.
Fix existing instructions to put files into correct places.

Fixes: QTBUG-112024
Pick-to: 6.7
Change-Id: I6a3d84edc1c67281d5497e99144c159faf0f783c
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io>
2024-01-25 15:13:29 +02:00
Kai Köhne 9a61a3a987 Demos: Add dependency info to example metadata
Add metadata about build time / runtime dependencies in the form
of Qt documentation modules. This should allow Qt Creator to hide
examples where needed Qt modules are not installed (because they
are optional in the Qt Online Installer).

Pick-to: 6.7
Task-number: QTBUG-120759
Change-Id: I03d8d75b273fe497803b9af9783b90e397b0638d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2024-01-19 10:26:22 +01:00
Kai Köhne 625b277c58 Doc: drop 'example' from title of application examples
There is no need to keep the example in the title, see also
https://wiki.qt.io/Qt6/Example-Guideline .

Pick-to: 6.7
Change-Id: If173285c2e0f0ef7d21a113e4e0713aef84511dc
Reviewed-by: Pranta Ghosh Dastider <pranta.dastider@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2024-01-10 16:02:48 +01:00
Rami Potinkara 33d02572d8 Docs: add QML Media Player and Dice to Mobile category
Task-number: QTBUG-117458
Pick-to: 6.7
Change-Id: Iccc2c7bc47118c21fce72f23ef489bb4476a8644
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2023-12-19 20:03:00 +02:00
Mikko Hallamaa d48dab50b5 Media player demo: Fix audio track reverting to "No track"
In the Media player demo, when an audio file was played, the audio track
reverted to "No track". This was because the audio track index was set
to follow the selected video track index. This is now fixed.

Additionally fixed some warning spam caused by a missing function return
type.

Fixes: QTBUG-117647
Pick-to: 6.6 6.5
Change-Id: I3b8f331f23ff6a677785bc7456ee1cbc64f27842
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
2023-11-27 13:30:42 +01:00
Bartlomiej Moskal d0ab362010 Fit Mediaplayer example to smaller screens
Playback control panel of Mediaplayer example did not fit to smaller
screen. It happened that playlist button goes outside of screen on
Android devices.

To make it fit, two icons (Rate_Icon and Mute_Icon) will be hidden on
smaller screens. Also some spacing will be smaller for portrait mode.

Pick-to: 6.6 6.5
Fixes: QTBUG-118043
Change-Id: Ic562ae7349f0b5d6b39b031dad9c4a4108027f7e
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-11-10 08:59:33 +01:00
Nicholas Bennett 045ad9a5f0 Docs: Update MediaPlayer Application Example documentation
Added images, snippets and overviews.

Fixes: QTBUG-116259
Change-Id: Ib3caf3a7c0e5d2d9d2145690f0fe2456b0e2d344
Reviewed-by: Mats Honkamaa <mats.honkamaa@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2023-10-20 12:10:36 +00:00
Friedemann Kleint ac5e3ca3c2 MediaPlayer demo: Add a Python driver
Task-number: PYSIDE-2206
Change-Id: I75961a0b1fac74808627483a4274c5eb078a0de2
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-09-07 12:42:49 +02:00
Assam Boudjelthia 4ebeb2ddcd Small fixes media player example on Android
* Explicitly link to MediaPlayer module so it gets packaged to the APK.
* Allow the example to user nameFilters after the fix
0f4181919663e85ddc142456b357dcde3d0a4a7f.

Pick-to: 6.6
Change-Id: I16c2feccb90ce7448ae24d03868fbedf3c449e66
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-08-28 11:39:36 +03:00
Friedemann Kleint b2b0d99dbe MediaPlayer demo: Move icons around
Move all icons in an "icon" folder of the respective module.
Rename Config.iconSource() to Config.iconName() and change it to just
return the icon name according to theme without any path.
Add 2 singletons to each module providing iconSource() functions
doing the lookup relative to their locations.

Pick-to: 6.6
Task-number: PYSIDE-2206
Change-Id: I8e74ce633400ae170f0fdb467a2ae65f172319b8
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-08-21 11:13:14 +02:00
Topi Reinio 17f35126dc Doc: Fix broken links
Remove links to examples that no longer exist, and fix linking to
page/section titles that have changed.

Fix other minor issues in passing.

Pick-to: 6.5 6.6
Change-Id: I6420fd7319e021f8a31f1776b31fabd05631c145
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-08-17 07:31:47 +00:00
Friedemann Kleint 5462256d17 MediaPlayer demo: Create a loadable module
Establish a common file layout allowing
Python and C++ to use loadFromModule().

Add a manually created qmldir file for usage by Python and the qml tool
(note CMake will still generate its own).

Pick-to: 6.6
Task-number: PYSIDE-2206
Change-Id: Idf2564ed84bd6c95e76dacdfbc0a9691c64e5f15
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-07-28 10:49:16 +02:00
Kai Köhne 8c0e710650 MediaPlayer example: Use camel case for menu entries
Pick-to: 6.5 6.6
Change-Id: If56f3014d3550ef237cb7ed513234a7b5dfc23aa
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
2023-06-30 15:37:11 +02:00
Friedemann Kleint e6459c530f MediaPlayer example: Add filters to the file dialog
Add filters and pre-select MP4.

Pick-to: 6.6
Change-Id: I36d47602607a0201631b0c948efbaa8f3b3cb3d2
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-06-29 16:21:31 +02:00
Friedemann Kleint 943ec55d78 MediaPlayer example: Handle the command line argument "source"
Make it a required property which is always set with a check.

Pick-to: 6.6
Change-Id: I7771bcbe7b3ccc798b885682135d501e2d4d60ee
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-27 14:15:40 +02:00
Kimmo Leppälä 2576db7f0e Add Media Player example to Mobile category
In addition to Application Example Media, Player is added to Mobile
category

Pick-to: 6.5.2 6.5 6.6
Change-Id: If4ba1813006fae626c6ea4a16f19bee34fc08f43
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-06-27 09:36:26 +00:00
Friedemann Kleint d5e81b7fa0 MediaPlayer example: Point the file dialog to the video directory
Pick-to: 6.6
Change-Id: I8c3cf40a36429b9480d27a5e483b3a90a89381dd
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-06-26 15:12:58 +02:00
Amir Masoud Abdol ee0cdb359c Rename mediaplayer demo/example to MediaPlayerApp
The same example exists in qtmultimedia, and it is using a similar
target name as well, which can breaks the top-level build, so we need a
new name for it. I thought since this is a demo project, and it's an
app, we can name it like the ToDoListApp.

Pick-to: 6.5 6.6
Change-Id: Ia91786f7a32e1263157091b10683cd5294c292a2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-17 04:59:28 +02:00
Amir Masoud Abdol 6d8609cee2 Adjust the path for qtdoc/demos
Pick-to: 6.5 6.6
Change-Id: I25ee66a178db832554276ef66dcd1f94ab925240
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-06-17 04:59:16 +02:00
Kai Köhne e1220042e6 Doc: Add more examples to Application Examples category
Add following examples to Application Examples category:

* Robot Arm Example
* Qt Quick Demo - RESTful Color Palette API client
* Media Player Example
* Document Viewer

Pick-to: 6.5 6.6
Change-Id: Ie36bb9a09d7fe868db07e02edcb1778f214494e9
Reviewed-by: Kimmo Leppälä <kimmo.leppala@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-06-15 11:07:40 +02:00
Topi Reinio 48cc7d605e Doc: Fix documentation issues
* Add missing */ in external-resources.qdoc
* Remove linking to 3rd party attribution pages that no longer exist
* Fix Media Player Example documentation
    * Remove duplicate \example command
    * Fix \image file name

Pick-to: 6.6 6.5
Change-Id: Ie26e4cc9105a5c728de2ec18b514b5d5ba3d61b9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-09 14:17:22 +00:00
Kamil Hajdukiewicz d7554ab700 Refresh the 'Multimedia Player' example
Design of MultimediaPlayer example was refreshed.
New icons, colors, application structure were provided.
Some new functionalities were introduced to the sample:
playlist, shuffle, loop, dark mode.

Tested on Windows, Android Emulator, macOs, iOS emulator.

Change-Id: I38a8e203021edc97b70a4ab8f0d8d83c6d5ae45b
Pick-to: 6.5 6.6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-08 03:08:54 +02:00