// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) (2018-2022) Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement, located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying this distribution may also be found in the top-level NOTICE file appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%
using System;
using System.IO;
using System.Runtime.InteropServices;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine.Networking;
using UnityEngine.XR.MagicLeap.Native;
namespace UnityEngine.XR.MagicLeap
{
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.XR.MagicLeap.Native;
///
/// MLMedia APIs.
///
[Obsolete("MLMedia API is being deprecated and will be removed from the MagicLeap SDK. Use Unity's VideoPlayer component (requires Unity 2022.3.10) instead.")]
public partial class MLMedia
{
///
/// Media player script that allows playback of a streaming video (either from file or web URL)
/// This script will update the main texture parameter of the Renderer attached as a sibling
/// with the video frame from playback. Audio is also handled through this class and will
/// playback audio from the file.
///
public partial class Player : IMLMediaPlayer
{
// TODO : find a better place for these
public const string VTTMime = "text/vtt";
public const string TTMLMime = "application/ttml+xml";
private IntPtr WebVTTDataPtr;
private IntPtr TTMLDataPtr;
///
/// Handle for the unmanaged media player object.
///
private ulong handle = MagicLeapNativeBindings.InvalidHandle;
///
/// Handle for spatialized audio.
///
private ulong audioHandle = MagicLeapNativeBindings.InvalidHandle;
///
/// Handle for the managed media player object to pass to and from unmanaged code.
///
private GCHandle gcHandle;
///
/// Indicates if the media player was active before entering standby or pause.
///
private bool wasPlayingBeforePause = false;
///
/// Parser object for 608 captions.
///
private ParserCEA608 parser608;
///
/// Parser object for 708 captions.
///
private ParserCEA708 parser708;
///
/// Indicates if the media player is currently playing.
///
public bool IsPlaying
{
get { return GetState(PollingStateFlags.IsPlaying); }
}
///
/// Indicates if the media player has been prepared.
///
public bool IsPrepared
{
get;
private set;
}
///
/// The uri/path that the media player is currently set with.
///
public string Source
{
get;
private set;
}
///
/// List of info objects for the different tracks that need DRM preparation.
///
private List drmTrackInfos = new List();
///
/// List of all tracks found since media player preparation.
///
private List