By DavidMWilliams I have a Delphi XE6 FireMonkey project, intending to play videos on iOS and Android devices.
In my form I have TMediaPlayerControl and TMediaPlayer controls.
My code to play the video (passed in) is
MediaPlayer1.FileName := TPath.GetDocumentsPath + PathDelim + s;
Label1.Text := IntToStr(MediaPlayer1.Media.VideoSize.Truncate.X) + ‘x’ +
‘px ‘ + IntToStr(MediaPlayer1.Media.Duration div MediaTimeScale) + ‘ms’;
TrackBar1.Max := MediaPlayer1.Media.Duration;
The intention is that a label will show the resolution of the video and the trackbar will show the length of the video.
Yet, the Label shows as 0x0 and the trackbar has value 0.
Now, if I set the MediaPlayer property of the TMediaPlayerControl, ie
MediaPlayerControl1.MediaPlayer := MediaPlayer1;
the video does not play at all. Nothing happens. If I clear that property, then the video does play but only in an uncontrolled window in the middle of the screen, ignoring the TMediaPlayerControl entirely.
This code works with a FireMonkey Windows app but it seems it does not work for iOS or Android.
Am I doing something fundamentally wrong or is this just broken? In which case how do you play videos in FireMonkey for iOS/Android?
Thank you! …read more