Skip to content

How to set mimetype using Exoplayer IMA extension #7961

@krackjack234

Description

@krackjack234

[REQUIRED] Searched documentation and issues

[REQUIRED] How can we set the mimetype using exoplayer IMA extension

If we use the IMA Sdk directly, we can set the mime type using the below api:

 List<String> mimes = new ArrayList<>();
 mimes.add("video/mp4"); //client wants only mp4 creatives to be rendered
   adsRenderingSettings.setMimeTypes(mimes);

However if we use IMA extension we are not able to use this feature.
We see the below code in exoplayer IMA extension to set mime types

public void setSupportedContentTypes(@C.ContentType int... contentTypes) {
    List<String> supportedMimeTypes = new ArrayList<>();
    for (@C.ContentType int contentType : contentTypes) {
      // IMA does not support Smooth Streaming ad media.
      if (contentType == C.TYPE_DASH) {
        supportedMimeTypes.add(MimeTypes.APPLICATION_MPD);
      } else if (contentType == C.TYPE_HLS) {
        supportedMimeTypes.add(MimeTypes.APPLICATION_M3U8);
      } else if (contentType == C.TYPE_OTHER) {
        supportedMimeTypes.addAll(
            Arrays.asList(
                MimeTypes.VIDEO_MP4,
                MimeTypes.VIDEO_WEBM,
                MimeTypes.VIDEO_H263,
                MimeTypes.AUDIO_MP4,
                MimeTypes.AUDIO_MPEG));
      }
    }
    this.supportedMimeTypes = Collections.unmodifiableList(supportedMimeTypes);
  }

Using the above method we cannot set a specific mime type like only video/mp4.
Also is the content type mentioned here refers to type of ad creative?

Ideally it will be better to expose all the getters and setters of IMA library so that user of ima extension can get the full benefit of ima library.

Is this a feature missing in ima extension now?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions