#!/usr/bin/env python

import argparse

import gi
gi.require_version('Clutter', '1.0')
from gi.repository import Clutter
gi.require_version('ClutterGst', '3.0')
from gi.repository import ClutterGst

ClutterGst.init(None)

parser = argparse.ArgumentParser(description='Play video.')
parser.add_argument("video_file", type=str, help="Video file")
args = parser.parse_args()

stage = Clutter.Stage(
    width=800,
    height=600,
    layout_manager=Clutter.BinLayout(
        x_align=Clutter.BinAlignment.FILL,
        y_align=Clutter.BinAlignment.FILL
   )
)
stage.connect('destroy', lambda x: Clutter.main_quit())

player = ClutterGst.Playback()
player.set_filename(args.video_file)
player.set_audio_volume(0.75)
player.set_playing(True)

actor = Clutter.Actor(
    content=ClutterGst.Aspectratio(
        player=player,
        paint_borders=True
    )
)

stage.add_child(actor)
stage.show()

Clutter.main()
