Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set mimetype using Exoplayer IMA extension #7961

Closed
krackjack234 opened this issue Sep 22, 2020 · 2 comments
Closed

How to set mimetype using Exoplayer IMA extension #7961

krackjack234 opened this issue Sep 22, 2020 · 2 comments
Assignees

Comments

@krackjack234
Copy link

krackjack234 commented Sep 22, 2020

[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?

@andrewlewis
Copy link
Collaborator

Using the above method we cannot set a specific mime type like only video/mp4.

Would it meet your needs if there were a setter for that MIME types to include for C.TYPE_OTHER content types on ImaAdsLoader.Builder? The DASH/HLS types would continue to work in the same way.

Also is the content type mentioned here refers to type of ad creative?

Yes.

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.

Not all getters/setters make sense though as the IMA extension places extra restrictions (setEnablePreloading comes to mind -- the extension relies on this being enabled). I think the important ones are there already but please let me know if there are other cases you want to override.

Is this a feature missing in ima extension now?

I think so. I'll mark this as an enhancement. If you reply with an answer to my question above we should be able to address it soon.

@google-oss-bot
Copy link
Collaborator

Hey @krackjack234. We need more information to resolve this issue but there hasn't been an update in 14 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

ojw28 pushed a commit that referenced this issue Oct 17, 2020
Issue: #7961
PiperOrigin-RevId: 337069152
ojw28 added a commit that referenced this issue Oct 21, 2020
Issue: #7961
PiperOrigin-RevId: 337069152
@google google locked and limited conversation to collaborators Dec 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants