Esempio n. 1
0
    private void PlaybackStateChangedHandler(object sender, MediaPlayer.ChangedEventArgs <MediaPlayer.PlaybackState> args)
    {
        var newState = args.CurrentState;

        if (newState == MediaPlayer.PlaybackState.None || newState == MediaPlayer.PlaybackState.Ended)
        {
            SetText(string.Empty);
            lastId            = string.Empty;
            reportedSubtitles = false;
        }
        else if (newState == MediaPlayer.PlaybackState.Playing && !reportedSubtitles)
        {
            uint count = player.GetSublitlesTracksCount();

            for (uint i = 0; i < count; i++)
            {
                string id, title, language;

                player.GetSubtitlesTrack(i, out id, out title, out language);

                Debug.LogFormat("Subtitle track id={0}, title='{1}', language={2}", id, title, language);
            }

            reportedSubtitles = true;
        }
    }
Esempio n. 2
0
    private void PlaybackStateChangedHandler(object sender, MediaPlayer.ChangedEventArgs <MediaPlayer.PlaybackState> args)
    {
        var newState = args.CurrentState;

        if (newState == MediaPlayer.PlaybackState.Playing)
        {
            var w = player.GetVideoWidth();
            var h = player.GetVideoHeight();

            if (w != 0 && h != 0)
            {
                var scale = gameObject.transform.localScale;
                scale.y = scale.x * h / w;
                gameObject.transform.localScale = scale;
            }
        }
    }