1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import javafx.application.Application import javafx.scene.Scene import javafx.scene.layout.StackPane import javafx.stage.Stage import javafx.scene.media.Media import javafx.scene.media.MediaPlayer import javafx.scene.media.MediaView import java.io.File class VideoPlayerApp : Application() { override fun start(primaryStage: Stage) { val videoFile = File("ruta/al/video.mp4").toURI().toString() // Reemplaza "ruta/al/video.mp4" con la ubicación de tu archivo MP4 val media = Media(videoFile) val mediaPlayer = MediaPlayer(media) val mediaView = MediaView(mediaPlayer) val root = StackPane() val scene = Scene(root, 800.0, 600.0) root.children.add(mediaView) primaryStage.title = "Reproductor de Video" primaryStage.scene = scene mediaPlayer.play() primaryStage.show() } } fun main() { Application.launch(VideoPlayerApp::class.java) } |