当前位置: 首页>>代码示例>>Java>>正文


Java Util.getUserAgent方法代码示例

本文整理汇总了Java中com.google.android.exoplayer.util.Util.getUserAgent方法的典型用法代码示例。如果您正苦于以下问题:Java Util.getUserAgent方法的具体用法?Java Util.getUserAgent怎么用?Java Util.getUserAgent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.exoplayer.util.Util的用法示例。


在下文中一共展示了Util.getUserAgent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRendererBuilder

import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
private VideoPlayer.RendererBuilder getRendererBuilder() {
    String userAgent = Util.getUserAgent(getActivity(), "ExoVideoPlayer");
    Uri contentUri = Uri.parse(mSelectedVideo.videoUrl);
    int contentType = Util.inferContentType(contentUri.getLastPathSegment());

    switch (contentType) {
        case Util.TYPE_OTHER: {
            return new ExtractorRendererBuilder(getActivity(), userAgent, contentUri);
        }
        case Util.TYPE_DASH: {
            // Implement your own DRM callback here.
            MediaDrmCallback drmCallback = new WidevineTestMediaDrmCallback(null, null);
            return new DashRendererBuilder(getActivity(), userAgent, contentUri.toString(),
                    drmCallback);
        }
        case Util.TYPE_HLS: {
            return new HlsRendererBuilder(getActivity(), userAgent, contentUri.toString());
        }


        default: {
            throw new IllegalStateException("Unsupported type: " + contentType);
        }
    }
}
 
开发者ID:nejtv,项目名称:androidtv-sample,代码行数:26,代码来源:PlaybackOverlayFragment.java

示例2: getRendererBuilder

import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
private RendererBuilder getRendererBuilder() {
    Uri contentUri = Uri.parse(mDataSource);
    String userAgent = Util.getUserAgent(mAppContext, "IjkExoMediaPlayer");
    int contentType = inferContentType(contentUri);
    switch (contentType) {
        case Util.TYPE_SS:
            return new SmoothStreamingRendererBuilder(mAppContext, userAgent, contentUri.toString(),
                    new SmoothStreamingTestMediaDrmCallback());
     /*   case Util.TYPE_DASH:
            return new DashRendererBuilder(mAppContext , userAgent, contentUri.toString(),
                    new WidevineTestMediaDrmCallback(contentId, provider));*/
        case Util.TYPE_HLS:
            return new HlsRendererBuilder(mAppContext, userAgent, contentUri.toString());
        case Util.TYPE_OTHER:
        default:
            return new ExtractorRendererBuilder(mAppContext, userAgent, contentUri);
    }
}
 
开发者ID:bigjelly,项目名称:ShaddockVideoPlayer,代码行数:19,代码来源:IjkExoMediaPlayer.java

示例3: getRendererBuilder

import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
private RendererBuilder getRendererBuilder() {
	String userAgent = Util.getUserAgent(this, "ExoPlayerDemo");
	switch (contentType) {
	case TYPE_SS:
		return new SmoothStreamingRendererBuilder(this, userAgent, contentUri.toString(),
				new SmoothStreamingTestMediaDrmCallback());
	case TYPE_DASH:
		return new DashRendererBuilder(this, userAgent, contentUri.toString(),
				new WidevineTestMediaDrmCallback(contentId));
	case TYPE_HLS:
		return new HlsRendererBuilder(this, userAgent, contentUri.toString());
	case TYPE_OTHER:
		return new ExtractorRendererBuilder(this, userAgent, contentUri);
	default:
		throw new IllegalStateException("Unsupported type: " + contentType);
	}
}
 
开发者ID:vuthanhict,项目名称:ExoPlayerController,代码行数:18,代码来源:PlayerActivity.java

示例4: CustomExoPlayer

import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
public CustomExoPlayer(Context context) {
        this.context = context;
        this.mainHandler = new Handler(Looper.getMainLooper());
        this.userAgent = Util.getUserAgent(context, "ExoPlayerDemo");

        // 1. Instantiate the player.
        player = ExoPlayer.Factory.newInstance(2);
//        // 2. Construct renderers.
//        MediaCodecVideoTrackRenderer videoRenderer = ...
//        MediaCodecAudioTrackRenderer audioRenderer = ...
//        // 3. Inject the renderers through prepare.
//        player.prepare(videoRenderer, audioRenderer);
//        // 4. Pass the surface to the video renderer.
//        player.sendMessage(videoRenderer, MediaCodecVideoTrackRenderer.MSG_SET_SURFACE, surface);
//        // 5. Start playback.
//        player.setPlayWhenReady(true);
    }
 
开发者ID:quanhua92,项目名称:GLMediaPlayer,代码行数:18,代码来源:CustomExoPlayer.java

示例5: getRendererBuilder

import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
private RendererBuilder getRendererBuilder(Context context, Sample sample) {
  String userAgent = Util.getUserAgent(context, context.getApplicationInfo().name);
  switch (sample.getType()) {
    case SMOOTH_STREAMING:
      return new SmoothStreamingRendererBuilder(context, userAgent, sample.getUri(),
          new SmoothStreamingTestMediaDrmCallback());
    case DASH:
      return new DashRendererBuilder(context, userAgent, sample.getUri(),
          new WidevineTestMediaDrmCallback(sample.getContentId()), sample.getAudioCapabilities());
    case HLS:
      return new HlsRendererBuilder(context, userAgent, sample.getUri(),
          sample.getAudioCapabilities());
    case OTHER:
    case LOCAL:
      return new ExtractorRendererBuilder(context, userAgent, Uri.parse(sample.getUri()));
    default:
      throw new IllegalStateException("Unsupported type: " + sample.getType().toString());
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:20,代码来源:MediaPlayer.java

示例6: run

import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
@Override
public void run() {
  Looper.prepare();
  player = ExoPlayer.Factory.newInstance(1);
  player.addListener(this);
  ExtractorSampleSource  sampleSource = new ExtractorSampleSource(
      uri, new DefaultUriDataSource(context, Util.getUserAgent(context, "ExoPlayerExtVP9Test")),
      new DefaultAllocator(BUFFER_SEGMENT_SIZE), BUFFER_SEGMENT_SIZE * BUFFER_SEGMENT_COUNT,
      new WebmExtractor());
  LibvpxVideoTrackRenderer videoRenderer = new LibvpxVideoTrackRenderer(sampleSource, true);
  player.sendMessage(videoRenderer, LibvpxVideoTrackRenderer.MSG_SET_OUTPUT_BUFFER_RENDERER,
      new VpxVideoSurfaceView(context));
  player.prepare(videoRenderer);
  player.setPlayWhenReady(true);
  Looper.loop();
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:17,代码来源:VpxPlaybackTest.java

示例7: getRendererBuilder

import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
private RendererBuilder getRendererBuilder() {
        String userAgent = Util.getUserAgent(getActivity(), "ExoPlayerDemo");
        Uri uri = Uri.parse(mStreamUrl);
        int contentType = inferContentType(uri, null);
        switch (contentType) {
//            case TYPE_SS:
//                return new SmoothStreamingRendererBuilder(this, null, contentUri.toString(),
//                        new SmoothStreamingTestMediaDrmCallback());
//            case TYPE_DASH:
//                return new DashRendererBuilder(this, userAgent, contentUri.toString(),
//                        new WidevineTestMediaDrmCallback(contentId, provider));
            case TYPE_HLS:
                return new HlsRendererBuilder(getContext(), userAgent, mStreamUrl);
            case TYPE_OTHER:
                return new ExtractorRendererBuilder(getContext(), userAgent, uri);
            default:
                throw new IllegalStateException("Unsupported type: " + contentType);
        }
    }
 
开发者ID:PJakcson,项目名称:Mediathek,代码行数:20,代码来源:PlayerFragment.java

示例8: getRendererBuilder

import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
private VideoPlayer.RendererBuilder getRendererBuilder() {
    String userAgent = Util.getUserAgent(getActivity(), "ExoVideoPlayer");
    Uri contentUri = Uri.parse(mSelectedVideo.videoUrl);
    int contentType = Util.inferContentType(contentUri.getLastPathSegment());

    switch (contentType) {
        case Util.TYPE_OTHER: {
            return new ExtractorRendererBuilder(getActivity(), userAgent, contentUri);
        }
        default: {
            throw new IllegalStateException("Unsupported type: " + contentType);
        }
    }
}
 
开发者ID:ad-on-is,项目名称:chilly,代码行数:15,代码来源:PlaybackOverlayFragment.java

示例9: getHpLibRendererBuilder

import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
private RendererBuilder getHpLibRendererBuilder() {
  String userAgent = Util.getUserAgent(activity, "HpLib");
  switch (video_type.get(currentTrackIndex)) {
    case "hls":
      return new HlsRendererBuilder(activity, userAgent, video_url.get(currentTrackIndex));
    case "others":
      return new ExtractorRendererBuilder(activity, userAgent,
          Uri.parse(video_url.get(currentTrackIndex)));
    default:
      throw new IllegalStateException("Unsupported type: " + video_url.get(currentTrackIndex));
  }
}
 
开发者ID:karanvs,项目名称:ExVidPlayer,代码行数:13,代码来源:ExVidPlayerImp.java

示例10: onStart

import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
@Override
public void onStart(Intent paramIntent, int paramInt) {

    //stop the streaming
    Intent i = new Intent(StreamingService.this, PodcastingService.class);
    stopService(i);

    if (paramIntent != null) {
        this.audio = paramIntent.getStringExtra("audio");
        this.title = paramIntent.getStringExtra("title");
        this.text = paramIntent.getStringExtra("text");
        this.logo_url = paramIntent.getStringExtra("logo_url");
        this.logo = paramIntent.getByteArrayExtra("logo");
        this.mNM = ((NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE));

        try {
            // String with the url of the radio you want to play
            Uri radioUri = Uri.parse(audio);
            // Settings for exoPlayer
            Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
            String userAgent = Util.getUserAgent(this, "ComRadioPlayer");
            DataSource dataSource = new DefaultUriDataSource(this, null, userAgent);
            ExtractorSampleSource sampleSource = new ExtractorSampleSource(radioUri, dataSource, allocator, BUFFER_SEGMENT_SIZE * BUFFER_SEGMENT_COUNT);
            audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);
            // Prepare ExoPlayer
            exoPlayer.prepare(audioRenderer);
            exoPlayer.setPlayWhenReady(true);

            showNotification(text, title);
        } catch (Exception e) {
            Log.d("Streaming", "onStart", e);
        }
    }

}
 
开发者ID:ficiverson,项目名称:radiocom-android,代码行数:36,代码来源:StreamingService.java

示例11: startBasicPlayback

import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
private void startBasicPlayback() {
  player = ExoPlayer.Factory.newInstance(4);
  player.addListener(this);
  mediaController.setMediaPlayer(new PlayerControl(player));
  mediaController.setEnabled(true);
  ExtractorSampleSource sampleSource = new ExtractorSampleSource(
      contentUri,
      new DefaultUriDataSource(this, Util.getUserAgent(this, "ExoPlayerExtWebMDemo")),
      new DefaultAllocator(BUFFER_SEGMENT_SIZE), BUFFER_SEGMENT_SIZE * BUFFER_SEGMENT_COUNT,
      new WebmExtractor(), new FlacExtractor(), new OggExtractor());
  TrackRenderer videoRenderer =
      new LibvpxVideoTrackRenderer(sampleSource, true, handler, this, 50);
  if (useOpenGL) {
    player.sendMessage(videoRenderer, LibvpxVideoTrackRenderer.MSG_SET_OUTPUT_BUFFER_RENDERER,
        vpxVideoSurfaceView);
    surfaceView.setVisibility(View.GONE);
  } else {
    player.sendMessage(
        videoRenderer, LibvpxVideoTrackRenderer.MSG_SET_SURFACE,
        surfaceView.getHolder().getSurface());
    vpxVideoSurfaceView.setVisibility(View.GONE);
  }
  TrackRenderer opusAudioTrackRenderer = new LibopusAudioTrackRenderer(sampleSource);
  TrackRenderer flacAudioTrackRenderer = new LibflacAudioTrackRenderer(sampleSource);
  TrackRenderer mediaCodecAudioTrackRenderer = new MediaCodecAudioTrackRenderer(sampleSource,
      MediaCodecSelector.DEFAULT);

  player.prepare(videoRenderer, opusAudioTrackRenderer, flacAudioTrackRenderer,
      mediaCodecAudioTrackRenderer);
  player.setPlayWhenReady(true);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:32,代码来源:PlayerActivity.java

示例12: getRendererBuilder

import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
private RendererBuilder getRendererBuilder() {
    String userAgent = Util.getUserAgent(this, "ExoPlayerDemo");
    switch (contentType) {
        case Util.TYPE_HLS:
            return new HlsRendererBuilder(this, userAgent, contentUri.toString());
        default:
            throw new IllegalStateException("Unsupported type: " + contentType);
    }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:10,代码来源:PlayerActivity.java

示例13: run

import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
@Override
public void run() {
  Looper.prepare();
  player = ExoPlayer.Factory.newInstance(1);
  player.addListener(this);
  ExtractorSampleSource  sampleSource = new ExtractorSampleSource(
      uri,
      new DefaultUriDataSource(context, Util.getUserAgent(context, "ExoPlayerExtOpusTest")),
      new DefaultAllocator(BUFFER_SEGMENT_SIZE), BUFFER_SEGMENT_SIZE * BUFFER_SEGMENT_COUNT,
      new WebmExtractor());
  LibopusAudioTrackRenderer audioRenderer = new LibopusAudioTrackRenderer(sampleSource);
  player.prepare(audioRenderer);
  player.setPlayWhenReady(true);
  Looper.loop();
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:16,代码来源:OpusPlaybackTest.java

示例14: run

import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
@Override
public void run() {
  Looper.prepare();
  player = ExoPlayer.Factory.newInstance(1);
  player.addListener(this);
  ExtractorSampleSource  sampleSource = new ExtractorSampleSource(
      uri,
      new DefaultUriDataSource(context, Util.getUserAgent(context, "ExoPlayerExtFlacTest")),
      new DefaultAllocator(BUFFER_SEGMENT_SIZE), BUFFER_SEGMENT_SIZE * BUFFER_SEGMENT_COUNT,
      new WebmExtractor());
  LibflacAudioTrackRenderer audioRenderer = new LibflacAudioTrackRenderer(sampleSource);
  player.prepare(audioRenderer);
  player.setPlayWhenReady(true);
  Looper.loop();
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:16,代码来源:FlacPlaybackTest.java

示例15: getRendererBuilder

import com.google.android.exoplayer.util.Util; //导入方法依赖的package包/类
private DemoPlayer.RendererBuilder getRendererBuilder() {
    String userAgent = Util.getUserAgent(this, "ExoPlayerDemo");
    switch (contentType) {
        case Util.TYPE_DASH:
            return new DashRendererBuilder(this, userAgent, contentUri.toString());
        default:
            throw new IllegalStateException("Unsupported type: " + contentType);
    }
}
 
开发者ID:konifar,项目名称:droidkaigi2016,代码行数:10,代码来源:VideoPlayerActivity.java


注:本文中的com.google.android.exoplayer.util.Util.getUserAgent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。