Exemplo n.º 1
0
    def make(
        cls,
        linear=None,
        non_linear=None,
        companion=None,
        id=None,
        sequence=None,
        ad_id=None,
        api_framework=None,
    ):
        instance = check_and_convert(
            cls,
            args_dict=dict(
                linear=linear,
                non_linear=non_linear,
                companion=companion,
                id=id,
                sequence=sequence,
                ad_id=ad_id,
                api_framework=api_framework,
            ),
        )
        validators.validate(instance, cls.VALIDATORS)

        return instance
Exemplo n.º 2
0
    def make(
            cls,
            asset, delivery, type, width, height,
            codec=None, id=None, bitrate=None, min_bitrate=None, max_bitrate=None,
            scalable=None, maintain_aspect_ratio=None, api_framework=None,
    ):
        """
            Entry point for making MediaFile instances.

            :param asset: the url to the asset
            :param delivery: either “progressive” for progressive download protocols (such as HTTP)
            or “streaming” for streaming protocols.
            :param type: MIME type for the file container.
            Popular MIME types include, but are not limited to “video/x- flv” for Flash Video and “video/mp4” for MP4
            :param width: the native width of the video file, in pixels
            :param height: the native height of the video file, in pixels
            :param codec: the codec used to encode the file which can take values as specified by RFC 4281:
            http://tools.ietf.org/html/rfc4281
            :param id: an identifier for the media file
            :param bitrate: for progressive load video, the bitrate value specifies the average bitrate for the media file;
            :param min_bitrate: used in conjunction with max_bitrate for streaming videos
            :param max_bitrate: used in conjunction with min_bitrate for streaming videos
            :param scalable: identifies whether the media file is meant to scale to larger dimensions
            :param maintain_aspect_ratio: identifies whether aspect ratio for media file is maintained
            :param api_framework: identifies the API needed to execute an interactive media file
            :return:
        """
        instance = check_and_convert(
            cls,
            args_dict=dict(
                asset=asset,
                delivery=delivery,
                type=type,
                width=width,
                height=height,
                codec=codec,
                id=id,
                bitrate=bitrate,
                min_bitrate=min_bitrate,
                max_bitrate=max_bitrate,
                scalable=scalable,
                maintain_aspect_ratio=maintain_aspect_ratio,
                api_framework=api_framework,
            ),
        )

        if instance.type in (MimeType.FLASH, MimeType.JS):
            vs = list(cls.VALIDATORS)
        elif instance.delivery == Delivery.PROGRESSIVE:
            vs = list(cls.VALIDATORS) + [cls._validate_bitrate]
        else:
            vs = list(cls.VALIDATORS) + [cls._validate_min_max_bitrate]

        validators.validate(instance, vs)

        return instance
Exemplo n.º 3
0
    def make(cls, version, ad):
        instance = check_and_convert(
            cls,
            args_dict=dict(
                version=version,
                ad=ad,
            ),
        )
        validators.validate(instance, [cls._validate_version])

        return instance
Exemplo n.º 4
0
    def make(cls, duration, media_files, video_clicks=None, ad_parameters=None, tracking_events=None):
        instance = check_and_convert(
            cls,
            args_dict=dict(
                duration=duration,
                media_files=media_files,
                video_clicks=video_clicks,
                ad_parameters=ad_parameters,
                tracking_events=tracking_events,
            ),
        )
        validators.validate(instance)

        return instance