public bool OnAssetSelectRepresentation(
            CommonTypes.HVRAdaptationSet adaptionSet,
            uint representationIndex,
            CommonTypes.HVRRepresentation[] representations,
            uint representationCount,
            IntPtr userData
            )
        {
            if (onAssetSelectRepresentation != null)
            {
                onAssetSelectRepresentation(adaptionSet, representationIndex, representations, representationCount, userData);
            }

            float maxFrameRate = 0;

            for (int i = 0; i < representations.Length; ++i)
            {
                maxFrameRate = Mathf.Max(maxFrameRate, representations[i].maxFPS);
            }

            // Only allow representations of the same framerate to be selected
            // At the moment this will default to the highest available framerate
            // TODO Make this configurable
            if (representations[representationIndex].maxFPS == maxFrameRate)
            {
                return(true);
            }

            return(false);
        }
        public static bool OnAssetSelectRepresentation(
            IntPtr adaptionSet,
            uint representationIndex,
            IntPtr representations,
            uint representationCount,
            IntPtr userData
            )
        {
            CommonTypes.HVRAdaptationSet _adaptionSet = Helper.PtrToStruct <CommonTypes.HVRAdaptationSet>(adaptionSet);

            CommonTypes.HVRRepresentation[] _representations = new CommonTypes.HVRRepresentation[(int)representationCount];

            int representationStructSize = Marshal.SizeOf(typeof(CommonTypes.HVRRepresentation));

            for (int i = 0; i < _representations.Length; ++i)
            {
                IntPtr dataPtr = new IntPtr(representations.ToInt64() + representationStructSize * i);
                _representations[i] = Helper.PtrToStruct <CommonTypes.HVRRepresentation>(dataPtr);
            }

            if (userData != IntPtr.Zero)
            {
                AssetInterface asset = Helper.GCHandleToObject <AssetInterface>((GCHandle)userData);

                if (asset != null)
                {
                    return(asset.OnAssetSelectRepresentation(_adaptionSet, representationIndex, _representations, representationCount, userData));
                }
            }

            // at least must return true for one of the representationIndex within [0, representationCount)
            if (representationIndex == representationCount - 1)
            {
                return(true);
            }

            return(false);
        }