我们希望在我们的应用程序中同时播放多个视频。下面的这个示例在 Mac 上运行良好,但在 Android 上,我只看到左侧 QMLVideo
元素中的视频。
我从信号中注意到,两名玩家都进入了PlayingState
.
我还注意到,在 Android 上,status=MediaPlayer.Buffering
在 Mac 上status=MediaPlayer.Buffered
。但是,当使用单个Video
元素时也会观察到相同的状态,因此我认为这种差异在这里无关紧要。
这是 Qt 错误还是平台限制?我可以以某种方式检测到这个平台限制(以便相应地调整 UI)吗?
import QtQuick 2.5
import QtQuick.Window 2.2
import QtMultimedia 5.5
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Video {
id: v1
width: parent.width/2
height: parent.height
anchors.left: parent.left
source: "http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"
onStatusChanged: console.log("Status V1 "+status + "//" + MediaPlayer.Buffering)
onAvailabilityChanged: console.log("Availability V1 "+availability)
onErrorChanged: console.log("Error V1 "+error + "//"+ errorString)
onPlaybackStateChanged: console.log("PlaybackState V1 "+playbackState)
}
Video {
id: v2
width: parent.width/2
height: parent.height
anchors.right: parent.right
source: "http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"
onStatusChanged: console.log("Status V2 "+status + "//" + MediaPlayer.Buffering)
onErrorChanged: console.log("Error V2 "+error + "//"+ errorString)
onPlaybackStateChanged: console.log("PlaybackState V2 "+playbackState)
}
Component.onCompleted: {
v1.play()
v2.play()
}
}