Video 如何在Blackberry中播放视频文件
我是黑莓开发的新手。现在我想在我的Blackberry应用程序中播放一个视频文件。现在播放器将显示如下: 这是我的密码Video 如何在Blackberry中播放视频文件,video,blackberry,blackberry-10,playback,Video,Blackberry,Blackberry 10,Playback,我是黑莓开发的新手。现在我想在我的Blackberry应用程序中播放一个视频文件。现在播放器将显示如下: 这是我的密码 import bb.cascades 1.0 import bb.multimedia 1.0 Page { Container { Button { id: playButton text: "Play" horizontalAlignment: HorizontalAlign
import bb.cascades 1.0
import bb.multimedia 1.0
Page {
Container {
Button {
id: playButton
text: "Play"
horizontalAlignment: HorizontalAlignment.Center
onClicked: {
if (!player.isPlaying) {
console.log("myPlayer.isPlaying = true");
player.play();
} else {
console.log("myPlayer.isPlaying = false");
player.pause();
}
}
}
ForeignWindowControl {
id: videoSurface
windowId: "myVideoSurface"
updatedProperties: WindowProperty.Size |
WindowProperty.Position | WindowProperty.Visible
visible: boundToWindow
preferredWidth: 640
preferredHeight: 480
}
attachedObjects: [
MediaPlayer {
id: player
property bool isPlaying: false
sourceUrl: "asset:///Videos/instruction.mp4"
videoOutput: VideoOutput.PrimaryDisplay
windowId: videoSurface.windowId
onMediaStateChanged: {
if (player.mediaState == MediaState.Started) {
console.log("player Started");
playButton.text = "Pause"
isPlaying = true;
} else if (player.mediaState == MediaState.Paused) {
console.log("player Paused");
playButton.text = "Play"
isPlaying = false;
} else if (player.mediaState == MediaState.Stopped) {
console.log("player Stopped");
playButton.text = "Play"
isPlaying = false;
}
}
}
] //attachedObjects
}
}
现在,当点击播放按钮时,它将像图像一样显示您是否已签出这些和。它们很可能就是你要找的。我已经更新了我的问题。请检查。运行代码时会发生什么情况?@donturner播放器将显示为图像。并且没有播放视频。