GVKun编程网logo

使用JSF的Spring Boot;找不到工厂javax.faces.context.FacesContextFactory的备份(org.slf4j.loggerfactory 找不到)

6

关于使用JSF的SpringBoot;找不到工厂javax.faces.context.FacesContextFactory的备份和org.slf4j.loggerfactory找不到的问题就给大家

关于使用JSF的Spring Boot;找不到工厂javax.faces.context.FacesContextFactory的备份org.slf4j.loggerfactory 找不到的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于com.facebook.presto.spi.connector.ConnectorContext的实例源码、com.facebook.presto.spi.ConnectorFactory的实例源码、com.google.android.exoplayer2.extractor.DefaultExtractorsFactory的实例源码、com.intellij.util.xml.impl.ConvertContextFactory的实例源码等相关知识的信息别忘了在本站进行查找喔。

本文目录一览:

使用JSF的Spring Boot;找不到工厂javax.faces.context.FacesContextFactory的备份(org.slf4j.loggerfactory 找不到)

使用JSF的Spring Boot;找不到工厂javax.faces.context.FacesContextFactory的备份(org.slf4j.loggerfactory 找不到)

我在使用Spring Boot和JSF时遇到一些问题。servlet似乎正确启动,但是当我尝试访问资源时,出现以下异常

java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory.     at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1011)    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:343)    at javax.faces.webapp.FacesServlet.init(FacesServlet.java:302)    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:884)    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:134)    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)    at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683)    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1720)    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1679)    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)    at java.lang.Thread.run(Thread.java:724)

我的应用程序类如下

@Configuration@EnableAutoConfiguration@ComponentScanpublic class Application extends SpringBootServletInitializer {    public static void main(String[] args) {        SpringApplication.run(Application.class);    }    @Override    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {        return application.sources(Application.class);    }    @Bean    public FacesServlet facesServlet() {        return new FacesServlet();    }    @Bean    public ServletRegistrationBean facesServletRegistration() {        ServletRegistrationBean registration = new ServletRegistrationBean(            facesServlet(), "*.xhtml");        registration.setName("Christmas");        return registration;    }    @Bean    public ServletListenerRegistrationBean<ConfigureListener> jsfConfigureListener() {        return new ServletListenerRegistrationBean<ConfigureListener>(            new ConfigureListener());    }}

我没有web.xml或faces-config.xml,而我的pom.xml如下

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">    <modelVersion>4.0.0</modelVersion>    <groupId>com.x.y.z</groupId>    <artifactId>project</artifactId>    <version>0.0.1-SNAPSHOT</version>    <packaging>jar</packaging>    <parent>        <groupId>org.springframework.boot</groupId>        <artifactId>spring-boot-starter-parent</artifactId>        <version>1.1.5.RELEASE</version>    </parent>    <build>        <plugins>            <plugin>                <groupId>org.springframework.boot</groupId>                <artifactId>spring-boot-maven-plugin</artifactId>            </plugin>        </plugins>    </build>    <dependencies>        <dependency>            <groupId>org.springframework.boot</groupId>            <artifactId>spring-boot-starter-web</artifactId>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-web</artifactId>        </dependency>        <dependency>            <groupId>org.primefaces</groupId>            <artifactId>primefaces</artifactId>            <version>5.0</version>        </dependency>        <!-- JSF 2 -->        <dependency>            <groupId>com.sun.faces</groupId>            <artifactId>jsf-api</artifactId>            <version>2.1.11</version>        </dependency>        <dependency>            <groupId>com.sun.faces</groupId>            <artifactId>jsf-impl</artifactId>            <version>2.1.11</version>        </dependency>    </dependencies></project>

我怀疑与jsf api有关的依赖项中存在一些冲突,但我似乎无法弄清楚哪里。任何解决此问题的帮助将不胜感激。

答案1

小编典典

要使JSF在不带的Spring Boot上运行,web.xml或者faces-config.xml您需要通过上的init参数强制其加载其配置文件ServletContext。一个简单的方法是实现ServletContextAware

public class Application implements ServletContextAware {    // ...    @Override    public void setServletContext(ServletContext servletContext) {        servletContext.setInitParameter("com.sun.faces.forceLoadConfiguration", Boolean.TRUE.toString());               }}

JSF ConfigureListener还依赖于JSP,因此您需要在pom中添加对Jasper的依赖:

<dependency>    <groupId>org.apache.tomcat.embed</groupId>    <artifactId>tomcat-embed-jasper</artifactId></dependency>

它与您的问题没有直接关系,但是您不需要声明FacesServlet为bean。该ServletRegistrationBean是足够了。

这使得Application.java寻找如下:

import javax.faces.webapp.FacesServlet;import javax.servlet.ServletContext;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.EnableAutoConfiguration;import org.springframework.boot.context.embedded.ServletListenerRegistrationBean;import org.springframework.boot.context.embedded.ServletRegistrationBean;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.ComponentScan;import org.springframework.context.annotation.Configuration;import org.springframework.web.context.ServletContextAware;import com.sun.faces.config.ConfigureListener;@Configuration@EnableAutoConfiguration@ComponentScanpublic class Application implements ServletContextAware {    public static void main(String[] args) {        SpringApplication.run(Application.class);    }    @Bean    public ServletRegistrationBean facesServletRegistration() {        ServletRegistrationBean registration = new ServletRegistrationBean(            new FacesServlet(), "*.xhtml");        registration.setLoadOnStartup(1);        return registration;    }    @Bean    public ServletListenerRegistrationBean<ConfigureListener> jsfConfigureListener() {        return new ServletListenerRegistrationBean<ConfigureListener>(            new ConfigureListener());    }    @Override    public void setServletContext(ServletContext servletContext) {        servletContext.setInitParameter("com.sun.faces.forceLoadConfiguration", Boolean.TRUE.toString());           }}

com.facebook.presto.spi.connector.ConnectorContext的实例源码

com.facebook.presto.spi.connector.ConnectorContext的实例源码

项目:paraflow    文件:HDFSConnectorFactory.java   
@Override
public Connector create(String connectorId,Map<String,String> config,ConnectorContext context)
{
    requireNonNull(config,"config is null");

    try {
        Bootstrap app = new Bootstrap(
                new JsonModule(),new HDFSModule(connectorId,context.getTypeManager())
        );

        Injector injector = app
                .strictConfig()
                .donotinitializeLogging()
                .setrequiredConfigurationProperties(config)
                .initialize();

        return injector.getInstance(HDFSConnector.class);
    }
    catch (Exception e) {
        e.printstacktrace();
    }
    return null;
}
项目:presto-kudu    文件:KuduConnectorFactory.java   
@Override
public Connector create(final String connectorId,String> requiredConfig,ConnectorContext context)
{
    requireNonNull(requiredConfig,"config is null");

    try {
        Bootstrap app = new Bootstrap(
                binder -> binder.bind(NodeManager.class).toInstance(context.getNodeManager()),new KuduModule(connectorId));

        Injector injector = app
                .strictConfig()
                .donotinitializeLogging()
                .setrequiredConfigurationProperties(requiredConfig)
                .initialize();

        return injector.getInstance(KuduConnector.class);
    }
    catch (Exception e) {
        throw Throwables.propagate(e);
    }
}
项目:presto-plugins    文件:SpreadsheetConnectorFactory.java   
@Override
public Connector create(String connectorId,ConnectorContext context) {
  Path basePath = new Path(config.get(BASEPATH));
  String spreadsheetSubDir = config.get(SUBDIR);
  String useFileCacheStr = config.get(USE_FILE_CACHE);
  String proxyUserStr = config.get(PROXY_USER);
  boolean proxyUser = false;
  if (proxyUserStr != null) {
    proxyUser = Boolean.parseBoolean(proxyUserStr);
  }
  boolean useFileCache = true;
  if (useFileCacheStr != null) {
    useFileCache = Boolean.parseBoolean(useFileCacheStr);
  }
  try {
    return new SpreadsheetConnector(UserGroupinformation.getCurrentUser(),_configuration,basePath,spreadsheetSubDir,useFileCache,proxyUser);
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
项目:presto-rest    文件:RestConnectorFactory.java   
@Override
public Connector create(String s,ConnectorContext context)
{
    NodeManager nodeManager = context.getNodeManager();

    return new RestConnector(nodeManager,restFactory.create(config));
}
项目:presto-ethereum    文件:EthereumConnectorFactory.java   
@Override
    public Connector create(String connectorId,ConnectorContext context) {
        requireNonNull(connectorId,"connectorId is null");
        requireNonNull(config,"config is null");

        try {
            Bootstrap app = new Bootstrap(
//                    new JsonModule(),new EthereumConnectorModule(),binder -> {
                        binder.bind(EthereumConnectorId.class).toInstance(new EthereumConnectorId(connectorId));
                        binder.bind(TypeManager.class).toInstance(context.getTypeManager());
                        binder.bind(NodeManager.class).toInstance(context.getNodeManager());
                    }
            );

            Injector injector = app.strictConfig()
                    .donotinitializeLogging()
                    .setrequiredConfigurationProperties(config)
                    .initialize();

            return injector.getInstance(EthereumConnector.class);
        }
        catch (Exception e) {
            throw Throwables.propagate(e);
        }
    }
项目:monarch    文件:AmpoolConnectorFactory.java   
public Connector create(final String connectorId,ConnectorContext context) {
  requireNonNull(requiredConfig,"requiredConfig is null");

  final String
      locator_host =
      requiredConfig
          .getorDefault(MonarchProperties.LOCATOR_HOST,MonarchProperties.LOCATOR_HOST_DEFAULT);
  final int
      locator_port =
      Integer.parseInt(requiredConfig
          .getorDefault(MonarchProperties.LOCATOR_PORT,MonarchProperties.LOCATOR_PORT_DEFAULT));

  // Create a client that connects to the Ampool cluster via a locator (that is already running!).
  final Properties props = new Properties();
  props.setProperty(Constants.MClientCacheconfig.MONARCH_CLIENT_LOG,requiredConfig
      .getorDefault(MonarchProperties.MONARCH_CLIENT_LOG,MonarchProperties.MONARCH_CLIENT_LOG_DEFAULT_LOCATION));
  final AmpoolClient aClient = new AmpoolClient(locator_host,locator_port,props);
  log.info("informatION: AmpoolClient created successfully.");

  try {
    Bootstrap
        app =
        new Bootstrap(new AmpoolModule(connectorId,aClient,context.getTypeManager()));

    Injector injector = app
        .donotinitializeLogging()
        .setrequiredConfigurationProperties(requiredConfig)
        .initialize();

    log.info("informatION: Injector initialized successfully.");
    return injector.getInstance(AmpoolConnector.class);
  } catch (Exception e) {
    throw Throwables.propagate(e);
  }
}
项目:presto-kinesis    文件:KinesisConnectorFactory.java   
@Override
public Connector create(String connectorId,ConnectorContext context)
{
    log.info("In connector factory create method.  Connector id: " + connectorId);
    requireNonNull(connectorId,"connectorId is null");
    requireNonNull(config,new KinesisConnectorModule(),binder -> {
                    binder.bindConstant().annotatedWith(Names.named("connectorId")).to(connectorId);
                    binder.bind(ConnectorId.class).toInstance(new ConnectorId(connectorId));
                    binder.bind(TypeManager.class).toInstance(context.getTypeManager());
                    binder.bind(NodeManager.class).toInstance(context.getNodeManager());
                    // Note: moved creation from KinesisConnectorModule because connector manager accesses it earlier!
                    binder.bind(KinesisHandleResolver.class).toInstance(new KinesisHandleResolver(connectorName));

                    // Moved creation here from KinesisConnectorModule to make it easier to parameterize
                    if (altProviderClass.isPresent()) {
                        binder.bind(KinesisClientProvider.class).to(altProviderClass.get()).in(Scopes.SINGLetoN);
                    }
                    else {
                        binder.bind(KinesisClientProvider.class).to(KinesisClientManager.class).in(Scopes.SINGLetoN);
                    }

                    if (tableDescriptionsupplier.isPresent()) {
                        binder.bind(new TypeLiteral<supplier<Map<SchemaTableName,KinesisstreamDescription>>>() {}).toInstance(tableDescriptionsupplier.get());
                    }
                    else {
                        binder.bind(new TypeLiteral<supplier<Map<SchemaTableName,KinesisstreamDescription>>>() {}).to(KinesisTableDescriptionsupplier.class).in(Scopes.SINGLetoN);
                    }
                }
        );

        this.injector = app.strictConfig()
                    .donotinitializeLogging()
                    .setrequiredConfigurationProperties(config)
                    .setoptionalConfigurationProperties(optionalConfig)
                    .initialize();

        KinesisConnector connector = this.injector.getInstance(KinesisConnector.class);

        // Register objects for shutdown,at the moment only KinesisTableDescriptionsupplier
        if (!tableDescriptionsupplier.isPresent()) {
            // This will shutdown related dependent objects as well:
            KinesisTableDescriptionsupplier supp = getTableDescsupplier(this.injector);
            connector.registerShutdownObject(supp);
        }

        log.info("Done with injector.  Returning the connector itself.");
        return connector;
    }
    catch (Exception e) {
        throw Throwables.propagate(e);
    }
}

com.facebook.presto.spi.ConnectorFactory的实例源码

com.facebook.presto.spi.ConnectorFactory的实例源码

项目:presto    文件:ExamplePlugin.java   
@Override
public synchronized <T> List<T> getServices(Class<T> type)
{
    if (type == ConnectorFactory.class) {
        return ImmutableList.of(type.cast(new ExampleConnectorFactory(typeManager,getoptionalConfig())));
    }
    return ImmutableList.of();
}
项目:presto    文件:RedisPlugin.java   
@Override
public synchronized <T> List<T> getServices(Class<T> type)
{
    if (type == ConnectorFactory.class) {
        return ImmutableList.of(type.cast(new RedisConnectorFactory(typeManager,nodeManager,tableDescriptionsupplier,optionalConfig)));
    }
    return ImmutableList.of();
}
项目:presto    文件:TestRedisPlugin.java   
@Test
public ConnectorFactory testConnectorExists()
{
    RedisPlugin plugin = new RedisPlugin();
    plugin.setTypeManager(new TestingTypeManager());
    plugin.setNodeManager(new TestingNodeManager());

    List<ConnectorFactory> factories = plugin.getServices(ConnectorFactory.class);
    assertNotNull(factories);
    assertEquals(factories.size(),1);
    ConnectorFactory factory = factories.get(0);
    assertNotNull(factory);
    return factory;
}
项目:presto    文件:TestRedisPlugin.java   
@Test
public void testStartup()
{
    ConnectorFactory factory = testConnectorExists();
    Connector c = factory.create("test-connector",ImmutableMap.<String,String>builder()
            .put("redis.table-names","test")
            .put("redis.nodes","localhost:6379")
            .build());
    assertNotNull(c);
}
项目:presto    文件:TestPostgresqlPlugin.java   
@Test
public void testCreateConnector()
        throws Exception
{
    Plugin plugin = new PostgresqlPlugin();
    ConnectorFactory factory = getonlyElement(plugin.getServices(ConnectorFactory.class));
    factory.create("test",ImmutableMap.of("connection-url","test"));
}
项目:presto    文件:JdbcPlugin.java   
@Override
public <T> List<T> getServices(Class<T> type)
{
    if (type == ConnectorFactory.class) {
        return ImmutableList.of(type.cast(new JdbcConnectorFactory(name,module,optionalConfig,getClassLoader())));
    }
    return ImmutableList.of();
}
项目:presto    文件:TestMysqLPlugin.java   
@Test
public void testCreateConnector()
        throws Exception
{
    Plugin plugin = new MysqLPlugin();
    ConnectorFactory factory = getonlyElement(plugin.getServices(ConnectorFactory.class));
    factory.create("test","test"));
}
项目:presto    文件:HivePlugin.java   
@Override
public <T> List<T> getServices(Class<T> type)
{
    if (type == ConnectorFactory.class) {
        return ImmutableList.of(type.cast(new HiveConnectorFactory(name,getClassLoader(),metastore,typeManager,pageIndexerFactory)));
    }
    return ImmutableList.of();
}
项目:presto-riak    文件:RiakPlugin.java   
@Override
public <T> List<T> getServices(Class<T> type) {
    if (type == ConnectorFactory.class) {
        return ImmutableList.of(type.cast(new RiakConnectorFactory(typeManager,getoptionalConfig())));
    }
    return ImmutableList.of();
}
项目:presto-kafka-connector    文件:KafkaPlugin.java   
@Override
public <T> List<T> getServices(Class<T> type)
{
    if (type == ConnectorFactory.class)
    {
        return ImmutableList.of(type.cast(new KafkaConnectorFactory(
                "kafka",getClassLoader())));
    }
    return ImmutableList.of();
}
项目:cloudata    文件:sqlEngine.java   
public sqlEngine(StructuredStore store,ExecutorService executor) {
    this.store = store;
    this.executor = executor;
    MetadataManager MetadataManager = new MetadataManager();

    SplitManager splitManager = new SplitManager(Sets.<ConnectorSplitManager> newHashSet());

    this.dataStreamManager = new DataStreamManager();
    HandleResolver handleResolver = new HandleResolver();
    Map<String,ConnectorFactory> connectorFactories = Maps.newHashMap();
    Map<String,Connector> globalConnectors = Maps.newHashMap();

    RecordSinkManager recordSinkManager = new RecordSinkManager();
    Map<String,ConnectorOutputHandleResolver> handleIdResolvers = Maps.newHashMap();
    OutputTableHandleResolver outputTableHandleResolver = new OutputTableHandleResolver(handleIdResolvers);

    this.connectorManager = new ConnectorManager(MetadataManager,splitManager,dataStreamManager,recordSinkManager,handleResolver,outputTableHandleResolver,connectorFactories,globalConnectors);

    // NodeManager nodeManager = new InMemoryNodeManager();
    PlanoptimizersFactory planoptimizersFactory = new PlanoptimizersFactory(MetadataManager,splitManager);
    List<Planoptimizer> planoptimizers = planoptimizersFactory.get();

    this.MetadataManager = MetadataManager;
    this.planoptimizers = planoptimizers;
    this.periodicImportManager = new StubPeriodicImportManager();
    this.storageManager = new StubStorageManager();

    NodeManager nodeManager = new InMemoryNodeManager();
    CloudataConnectorFactory cloudataConnectorFactory = new CloudataConnectorFactory(nodeManager,Maps.<String,String> newHashMap(),store);

    connectorManager.addConnectorFactory(cloudataConnectorFactory);

    connectorManager.createConnection(catalogName,CloudataConnectorFactory.PROVIDER_ID,String> newHashMap());

    this.cloudataConnector = cloudataConnectorFactory.get(catalogName);
}

com.google.android.exoplayer2.extractor.DefaultExtractorsFactory的实例源码

com.google.android.exoplayer2.extractor.DefaultExtractorsFactory的实例源码

项目:react-native-videoplayer    文件:ReactExoplayerView.java   
private MediaSource buildMediaSource(Uri uri,String overrideExtension) {
    int type = Util.inferContentType(!TextUtils.isEmpty(overrideExtension) ? "." + overrideExtension
            : uri.getLastPathSegment());
    switch (type) {
        case C.TYPE_SS:
            return new SsMediaSource(uri,buildDataSourceFactory(false),new DefaultSsChunkSource.Factory(mediaDataSourceFactory),mainHandler,null);
        case C.TYPE_DASH:
            return new DashMediaSource(uri,new DefaultDashChunkSource.Factory(mediaDataSourceFactory),null);
        case C.TYPE_HLS:
            return new HlsMediaSource(uri,mediaDataSourceFactory,null);
        case C.TYPE_OTHER:
            return new ExtractorMediaSource(uri,new DefaultExtractorsFactory(),null);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
项目:syncplayer    文件:MediaService.java   
@Override
public IBinder onBind(final Intent intent) {

    bandwidthMeter = new DefaultBandwidthMeter();
    TrackSelection.Factory videoTrackSelectionFactory =
            new AdaptiveTrackSelection.Factory(bandwidthMeter);

    dataSourceFactory = new DefaultDataSourceFactory(this,Util.getUserAgent(this,"SyncPlayer"),bandwidthMeter);

    extractorsFactory = new DefaultExtractorsFactory();

    TrackSelector trackSelector =
            new DefaultTrackSelector(videoTrackSelectionFactory);

    LoadControl loadControl = new DefaultLoadControl();

    SimpleExoPlayer player =
            ExoPlayerFactory.newSimpleInstance(getApplicationContext(),trackSelector,loadControl);
    mMediaPlayer = player;

    setCompletionListener();
    nbuilder.setSmallIcon(R.mipmap.ic_launcher);
    return mBinder;
}
项目:ExoPlayer-Offline    文件:PlayerActivity.java   
private MediaSource buildMediaSource(Uri uri,eventLogger);
        case C.TYPE_DASH:
            return new DashMediaSource(uri,eventLogger);
        case C.TYPE_HLS:
            return new HlsMediaSource(uri,eventLogger);
        case C.TYPE_OTHER:
            return new ExtractorMediaSource(uri,eventLogger);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
项目:QSVideoPlayer    文件:ExoMedia.java   
private MediaSource buildMediaSource(Context context,Uri uri) {
    int type = getUrlType(uri.toString());
    switch (type) {
        case C.TYPE_SS:
            return new SsMediaSource(uri,new DefaultDataSourceFactory(context,null,new DefaultHttpDataSourceFactory(USER_AGENT,null)),new DefaultSsChunkSource.Factory(new DefaultDataSourceFactory(context,BANDWIDTH_METER,BANDWIDTH_METER))),mainThreadHandler,new DefaultDashChunkSource.Factory(new DefaultDataSourceFactory(context,BANDWIDTH_METER)),null);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
项目:chaosflix-leanback    文件:PlayerActivity.java   
private MediaSource buildMediaSource(Uri uri,String overrideExtension) {
    DataSource.Factory mediaDataSourceFactory = buildDataSourceFactory(true);
    int type = TextUtils.isEmpty(overrideExtension) ? Util.inferContentType(uri)
            : Util.inferContentType("." + overrideExtension);
    switch (type) {
        case C.TYPE_SS:
            return new SsMediaSource(uri,null);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
项目:BakingApp    文件:StepDetailFragment.java   
private void initializePlayer(Uri videoUri){
    if (mExoPlayer == null){
        TrackSelector trackSelector = new DefaultTrackSelector();
        LoadControl loadControl = new DefaultLoadControl();
        mExoPlayer = ExoPlayerFactory.newSimpleInstance(getContext(),loadControl);
        mExoPlayer.addListener(this);
        mExoPlayer.seekTo(currentPosition);
        mPlayerView.setPlayer(mExoPlayer);
        String userAgent = Util.getUserAgent(getContext(),"Tasty");
        MediaSource mediaSource = new ExtractorMediaSource(videoUri,new DefaultDataSourceFactory(
                getContext(),userAgent),null);
        mExoPlayer.prepare(mediaSource);
        if (playWhenReady) mExoPlayer.setPlayWhenReady(true);
        else mExoPlayer.setPlayWhenReady(false);
    }
}
项目:chaosflix    文件:ExoPlayerFragment.java   
private MediaSource buildMediaSource(Uri uri,null);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
项目:chaosflix    文件:PlayerActivity.java   
private MediaSource buildMediaSource(Uri uri,null);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
项目:PreviewSeekBar    文件:ExoPlayerMediaSourceBuilder.java   
public MediaSource getMediaSource(boolean preview) {
    switch (streamType) {
        case C.TYPE_SS:
            return new SsMediaSource(uri,getHttpDataSourceFactory(preview)),new DefaultSsChunkSource.Factory(getDataSourceFactory(preview)),new DefaultDashChunkSource.Factory(getDataSourceFactory(preview)),getDataSourceFactory(preview),null);
        default: {
            throw new IllegalStateException("Unsupported type: " + streamType);
        }
    }
}
项目:PreviewSeekBar-master    文件:ExoPlayerMediaSourceBuilder.java   
public MediaSource getMediaSource(boolean preview) {
    switch (streamType) {
        case C.TYPE_SS:
            return new SsMediaSource(uri,null);
        default: {
            throw new IllegalStateException("Unsupported type: " + streamType);
        }
    }
}
项目:Melophile    文件:mediaplayback21.java   
@Override
public void startPlayer() {
    if(exoPlayer==null){
        exoPlayer =
                ExoPlayerFactory.newSimpleInstance(
                        context,new DefaultTrackSelector(),new DefaultLoadControl());
        exoPlayer.addListener(this);
    }
    exoPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
    DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(
            context,Util.getUserAgent(context,"uamp"),null);
    ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
    MediaSource mediaSource = new ExtractorMediaSource(
            Uri.parse(currentUrl),dataSourceFactory,extractorsFactory,null);
    exoPlayer.prepare(mediaSource);
    configPlayer();
}
项目:Cable-Android    文件:VideoPlayer.java   
private void setExoViewSource(@NonNull MasterSecret masterSecret,@NonNull VideoSlide videoSource)
    throws IOException
{
  BandwidthMeter         bandwidthMeter             = new DefaultBandwidthMeter();
  TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
  TrackSelector          trackSelector              = new DefaultTrackSelector(videoTrackSelectionFactory);
  LoadControl            loadControl                = new DefaultLoadControl();

  exoPlayer = ExoPlayerFactory.newSimpleInstance(getContext(),loadControl);
  exoView.setPlayer(exoPlayer);

  DefaultDataSourceFactory    defaultDataSourceFactory    = new DefaultDataSourceFactory(getContext(),"GenericUserAgent",null);
  AttachmentDataSourceFactory attachmentDataSourceFactory = new AttachmentDataSourceFactory(getContext(),masterSecret,defaultDataSourceFactory,null);
  ExtractorsFactory           extractorsFactory           = new DefaultExtractorsFactory();

  MediaSource mediaSource = new ExtractorMediaSource(videoSource.getUri(),attachmentDataSourceFactory,null);

  exoPlayer.prepare(mediaSource);
  exoPlayer.setPlayWhenReady(true);
}
项目:android-arch-components-lifecycle    文件:VideoPlayerComponent.java   
private void initializePlayer() {
    if (player == null) {
        trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
        player = ExoPlayerFactory.newSimpleInstance(context,trackSelector);
        player.addListener(this);
        DefaultDataSourceFactory dataSourceFactory = new DefaultDataSourceFactory(context,"testApp"),bandwidthMeter);

        ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
        ExtractorMediaSource videoSource = new ExtractorMediaSource(Uri.parse(videoUrl),null);
        simpleExoPlayerView.setPlayer(player);
        player.setPlayWhenReady(true);

        boolean haveResumePosition = resumeWindow != C.INDEX_UNSET;
        if (haveResumePosition) {
            Log.d(TAG,"Have Resume position true!" + resumePosition);
            player.seekTo(resumeWindow,resumePosition);
        }

        player.prepare(videoSource,!haveResumePosition,false);

    }
}
项目:nuclei-android    文件:ExoPlayerPlayback.java   
protected MediaSource newMediaSource(Context context,String url,int type,Handler handler) {
    boolean hls = false;
    boolean localFile = url.startsWith("file://");
    if (!localFile) {
        try {
            hls = type == MediaId.TYPE_VIDEO || Uri.parse(url).getPath().endsWith(".m3u8");
        } catch (Exception ignore) {
        }
    }
    // expecting MP3 here ... otherwise HLS
    if ((localFile || type == MediaId.TYPE_AUdio) && !hls) {
        return new ExtractorMediaSource(Uri.parse(url),buildDataSourceFactory(context,true,!localFile),handler,this);
    } else {
        return new HlsMediaSource(Uri.parse(url),true),this);
    }
}
项目:TigerVideo    文件:VideoExoPlayer.java   
private MediaSource buildMediaSource(Uri uri,String overrideExtension) {

        int type = Util.inferContentType(!TextUtils.isEmpty(overrideExtension) ? "." + overrideExtension
                : uri.getLastPathSegment());
        switch (type) {
            case C.TYPE_SS:
                return new SsMediaSource(uri,new DefaultSsChunkSource.Factory(mMediaDataSourceFactory),mMainHandler,mEventLogger);
            case C.TYPE_DASH:
                return new DashMediaSource(uri,new DefaultDashChunkSource.Factory(mMediaDataSourceFactory),mEventLogger);
            case C.TYPE_HLS:
                return new HlsMediaSource(uri,mMediaDataSourceFactory,mEventLogger);
            case C.TYPE_OTHER:
                return new ExtractorMediaSource(uri,mEventLogger);
            default: {
                throw new IllegalStateException("Unsupported type: " + type);
            }
        }
    }
项目:ExoPlayerVideoView    文件:ExoVideoView.java   
private MediaSource buildMediaSource(Uri uri,eventLogger);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
项目:K-Sonic    文件:KExoMediaPlayer.java   
private MediaSource buildMediaSource(Uri uri,eventLogger);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
项目:cpe-manifest-android-experience    文件:ECVideoViewFragment.java   
private MediaSource buildMediaSource(Uri uri) {
    int type = Util.inferContentType(uri.getLastPathSegment());
    switch (type) {
        case C.TYPE_SS:
            return new SsMediaSource(uri,new Handler(),null);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
项目:cpe-manifest-android-experience    文件:StartupActivity.java   
private MediaSource buildMediaSource(Uri uri) {
    int type = Util.inferContentType(uri.getLastPathSegment());
    switch (type) {
        case C.TYPE_SS:
            return new SsMediaSource(uri,null);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
项目:videoPickPlayer    文件:CustomExoPlayerView.java   
private MediaSource buildMediaSource(Uri uri,null);
        default: {
            throw new IllegalStateException("Unsupported type: " + type);
        }
    }
}
项目:itplayer    文件:PlayerActivity.java   
@Override
protected MediaSource[] doInBackground(MediaFile... media) {
    try {
        browser = browser.getInstance(Config.mountDirectory);

        DataSource.Factory dataSourceFactory = new NfsDataSourceFactory(browser.getContext());
        ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
        MediaSource videoSource = new ExtractorMediaSource(Uri.parse("nfs://host/" + media[0].getPath()),null);

        if (media[0].getSubtitlePath() != null) {
            Format subtitleFormat = Format.createTextSampleFormat(null,MimeTypes.APPLICATION_SUBRIP,Format.NO_VALUE,"en",null);
            MediaSource subtitleSource = new SingleSampleMediaSource(Uri.parse("nfs://host/" + media[0].getSubtitlePath()),subtitleFormat,Long.MAX_VALUE,0);

            return new MediaSource[]{videoSource,subtitleSource};
        } else
            return new MediaSource[]{videoSource};
    } catch (IOException e) {
        e.printstacktrace();
    }

    return null;
}
项目:Komica    文件:PlayerActivity.java   
private MediaSource buildMediaSource(Uri uri,String overrideExtension) {
  int type = Util.inferContentType(!TextUtils.isEmpty(overrideExtension) ? "." + overrideExtension
      : uri.getLastPathSegment());
  switch (type) {
    case C.TYPE_SS:
      return new SsMediaSource(uri,eventLogger);
    case C.TYPE_DASH:
      return new DashMediaSource(uri,eventLogger);
    case C.TYPE_HLS:
      return new HlsMediaSource(uri,eventLogger);
    case C.TYPE_OTHER:
      return new ExtractorMediaSource(uri,eventLogger);
    default: {
      throw new IllegalStateException("Unsupported type: " + type);
    }
  }
}
项目:Jockey    文件:QueuedExoPlayer.java   
private void prepare(boolean playWhenReady,boolean resetPosition) {
    mInvalid = false;

    if (mQueue == null) {
        return;
    }

    DataSource.Factory srcFactory = new DefaultDataSourceFactory(mContext,USER_AGENT);
    ExtractorsFactory extFactory = new DefaultExtractorsFactory();

    int startingPosition = resetPosition ? 0 : getCurrentPosition();

    if (mRepeatOne) {
        mExoPlayer.prepare(buildrepeatOneMediaSource(srcFactory,extFactory));
    } else if (mRepeatAll) {
        mExoPlayer.prepare(buildrepeatAllMediaSource(srcFactory,extFactory));
    } else {
        mExoPlayer.prepare(buildnorepeatMediaSource(srcFactory,extFactory));
    }

    mExoPlayer.seekTo(mQueueIndex,startingPosition);
    mExoPlayer.setPlayWhenReady(playWhenReady);
}
项目:yjplay    文件:MediaSourceBuilder.java   
/****
 * 初始化视频源,无缝衔接
 *
 * @param uri 视频的地址
 * @return MediaSource media source
 */
public MediaSource initMediaSource(Uri uri) {
    int streamType = VideoPlayUtils.inferContentType(uri);
    switch (streamType) {
        case C.TYPE_OTHER:
            Log.d(TAG,"TYPE_OTHER");
            return new ExtractorMediaSource.Factory(getDataSource())
                    .setExtractorsFactory(new DefaultExtractorsFactory())
                    .setMinLoadableRetryCount(5)
                    .setCustomCacheKey(uri.getPath())
                    .createMediaSource(uri,null);
        default:
            throw new IllegalStateException(context.getString(R.string.media_error));
    }
}
项目:yjplay    文件:WholeMediaSource.java   
@Override
public MediaSource initMediaSource(Uri uri) {
    int streamType = VideoPlayUtils.inferContentType(uri);
    switch (streamType) {
        case C.TYPE_SS:
            return new  SsMediaSource.Factory(new DefaultSsChunkSource.Factory(getDataSource()),getDataSource()))
                    .setMinLoadableRetryCount(5)
                    .createMediaSource(uri,sourceEventListener);
        case C.TYPE_DASH:
            return new DashMediaSource.Factory(new DefaultDashChunkSource.Factory(getDataSource()),getDataSource()))
                     .setMinLoadableRetryCount(5)
                     .createMediaSource(uri,sourceEventListener);
        case C.TYPE_OTHER:
            return new  ExtractorMediaSource.Factory( getDataSource())
                     .setExtractorsFactory( new DefaultExtractorsFactory())
                    .setMinLoadableRetryCount(5)
                    .setCustomCacheKey(uri.getPath())
                    .createMediaSource(uri,null);
        case C.TYPE_HLS:
            return new HlsMediaSource.Factory(new DefaultHlsDataSourceFactory( getDataSource()))
                    .setMinLoadableRetryCount(5)
                    .createMediaSource(uri,sourceEventListener);

        default:
            throw new IllegalStateException(":Unsupported type: " + streamType);
    }
}
项目:lostfilm-android-client    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    if (!isPlaying) {
        Handler mainHandler = new Handler();
        BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
        TrackSelection.Factory videoTrackSelectionFactory =
                new AdaptiveVideoTrackSelection.Factory(bandwidthMeter);
        TrackSelector trackSelector =
                new DefaultTrackSelector(videoTrackSelectionFactory);

        LoadControl loadControl = new DefaultLoadControl();

        SimpleExoPlayer player =
                ExoPlayerFactory.newSimpleInstance(MainActivity.this,loadControl);
        SimpleExoPlayerView playerView = (SimpleExoPlayerView) findViewById(R.id.videoView);
        playerView.setPlayer(player);
        DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(MainActivity.this,Util.getUserAgent(MainActivity.this,"yourApplicationName"));
        MediaSource mediaSource = new ExtractorMediaSource(Uri.parse("https://r7---sn-3c27ln7k.googlevideo.com/videoplayback?id=6fb497d0971b8cdf&itag=22&source=picasa&begin=0&requiressl=yes&mm=30&mn=sn-3c27ln7k&ms=nxu&mv=m&nh=IgphcjAzLmticDAxKgkxMjcuMC4wLjE&pl=22&sc=yes&mime=video/mp4&lmt=1486083166327499&mt=1486135406&ip=134.249.158.189&ipbits=8&expire=1486164239&sparams=ip,ipbits,expire,id,itag,source,requiressl,mm,mn,ms,mv,nh,pl,sc,mime,lmt&signature=3BB06D8D4294F8C49B3CE910B3D6849954302BB1.02ABE00700DFCEF715E72D0EFB73B67841E659F8&key=ck2&ratebypass=yes&title=%5BAnime365%5D%20Kuzu%20no%20Honkai%20-%2004%20(t1174045)"),null);
        player.prepare(mediaSource);
        player.setPlayWhenReady(true);

    }
}
项目:UdacityBakingAndroid    文件:StepFragment.java   
private void initializePlayer(Uri mediaUri) {
    if (mExoPlayer == null) {
        // Create an instance of the ExoPlayer.
        TrackSelector trackSelector = new DefaultTrackSelector();
        LoadControl loadControl = new DefaultLoadControl();
        mExoPlayer = ExoPlayerFactory.newSimpleInstance(getContext(),loadControl);
        binding.exoStepFragmentPlayerView.setPlayer(mExoPlayer);
        mExoPlayer.addListener(this);
        String userAgent = Util.getUserAgent(getContext(),"RecipestepVideo");
        MediaSource mediaSource = new ExtractorMediaSource(mediaUri,null);
        mExoPlayer.prepare(mediaSource);
        mExoPlayer.setPlayWhenReady(true);
    }
}
项目:B4A_ExoPlayer    文件:SimpleExoPlayerWrapper.java   
/**
 * Creates a Uri source for non-streaming media resources.
 */
public Object CreateUriSource (String Uri) {
    ExtractorMediaSource e = new ExtractorMediaSource(android.net.Uri.parse(Uri),createDefaultDataFactory(),null);
    return e;
}
项目:P2Video-master    文件:PlayerActivity.java   
/**
 * 播放启动视频
 */
private void startPlayer() {
    // 0.  set player view
    playerView = (SimpleExoPlayerView) findViewById(R.id.playerView);
    playerView.setUseController(false);
    playerView.getKeepScreenOn();
    playerView.setResizeMode(RESIZE_MODE_FILL);

    // 1. Create a default TrackSelector
    TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(new DefaultBandwidthMeter());
    trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);

    // 2. Create a default LoadControl
    loadControl = new DefaultLoadControl();

    // 3. Create the mPlayer
    mPlayer = ExoPlayerFactory.newSimpleInstance(this,loadControl);
    mPlayer.addListener(this);

    // 4. set player
    playerView.setPlayer(mPlayer);
    mPlayer.setPlayWhenReady(true);

    // 5. prepare to play
    File file = new File(Constants.FILE_VIDEO_FLODER,"jcode.mp4");
    if (file.isFile() && file.exists()) {
        mUri = Uri.fromFile(file);
    } else {
        Toast.makeText(this,"文件未找到",Toast.LENGTH_SHORT).show();
        return;
    }
    ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
    DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this,"UserAgent");
    videoSource = new ExtractorMediaSource(mUri,null);

    // 6. ready to play
    mPlayer.prepare(videoSource);
}
项目:yabaking    文件:ExoPlayerManager.java   
private MediaSource setUpMediaSource(Context context,Uri mediUri) {
    final String APPLICATION_BASE_USER_AGENT = "YaBaking";
    final String userAgent = Util.getUserAgent(context,APPLICATION_BASE_USER_AGENT);
    return new ExtractorMediaSource(
            mediUri,null);
}
项目:R-a-dio-Amazing-Android-App    文件:RadioService.java   
public void setupMediaPlayer() {
    DataSource.Factory dsf = new DefaultDataSourceFactory(this,"R/a/dio-Android-App"));
    ExtractorsFactory extractors = new DefaultExtractorsFactory();
    MediaSource audioSource = new ExtractorMediaSource(Uri.parse(radio_url),dsf,extractors,null);

    if(sep != null)
        sep.prepare(audioSource);
}
项目:AndroidAudioExample    文件:PlayerService.java   
@Override
public void onCreate() {
    super.onCreate();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        NotificationChannel notificationChannel = new NotificationChannel(NOTIFICATION_DEFAULT_CHANNEL_ID,getString(R.string.notification_channel_name),notificationmanagerCompat.IMPORTANCE_DEFAULT);
        notificationmanager notificationmanager = (notificationmanager) getSystemService(Context.NOTIFICATION_SERVICE);
        notificationmanager.createNotificationChannel(notificationChannel);

        AudioAttributes audioAttributes = new AudioAttributes.Builder()
                .setUsage(AudioAttributes.USAGE_MEDIA)
                .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
                .build();
        audioFocusRequest = new AudioFocusRequest.Builder(AudioManager.AUdioFOCUS_GAIN)
                .setonAudioFocuschangelistener(audioFocuschangelistener)
                .setAcceptsDelayedFocusGain(false)
                .setwillPauseWhenDucked(true)
                .setAudioAttributes(audioAttributes)
                .build();
    }

    audioManager = (AudioManager) getSystemService(Context.AUdio_SERVICE);

    mediaSession = new MediaSessionCompat(this,"PlayerService");
    mediaSession.setFlags(MediaSessionCompat.FLAG_HANDLES_MEDIA_BUTTONS | MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS);
    mediaSession.setCallback(mediaSessionCallback);

    Context appContext = getApplicationContext();

    Intent activityIntent = new Intent(appContext,MainActivity.class);
    mediaSession.setSessionActivity(PendingIntent.getActivity(appContext,activityIntent,0));

    Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON,appContext,MediaButtonReceiver.class);
    mediaSession.setMediaButtonReceiver(PendingIntent.getbroadcast(appContext,mediaButtonIntent,0));

    exoPlayer = ExoPlayerFactory.newSimpleInstance(new DefaultRenderersFactory(this),new DefaultLoadControl());
    exoPlayer.addListener(exoPlayerListener);
    DataSource.Factory httpDataSourceFactory = new OkHttpDataSourceFactory(new OkHttpClient(),getString(R.string.app_name)),null);
    Cache cache = new SimpleCache(new File(this.getCacheDir().getAbsolutePath() + "/exoplayer"),new LeastRecentlyUsedCacheevictor(1024 * 1024 * 100)); // 100 Mb max
    this.dataSourceFactory = new CacheDataSourceFactory(cache,httpDataSourceFactory,CacheDataSource.FLAG_BLOCK_ON_CACHE | CacheDataSource.FLAG_IGnorE_CACHE_ON_ERROR);
    this.extractorsFactory = new DefaultExtractorsFactory();
}
项目:react-native-exoplayer-intent-video    文件:PlayerController.java   
public PlayerController(Context context) {
    this.bandwidthMeter = new DefaultBandwidthMeter();
    this.loadControl = new DefaultLoadControl();
    this.extractorsFactory = new DefaultExtractorsFactory();
    this.trackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter);
    this.dataSourceFactory = new DefaultDataSourceFactory(context,Util.getUserAgent(context.getApplicationContext(),TAG_NAME),(TransferListener<? super DataSource>) bandwidthMeter);
    this.trackSelector = new DefaultTrackSelector(trackSelectionFactory);
    this.player = ExoPlayerFactory.newSimpleInstance(context,this.trackSelector,this.loadControl);
    this.playerView = new PlayerView(context,this.player);
}
项目:tumbviewer    文件:ExoPlayerInstance.java   
private ExoPlayerInstance() {
    this.context = ExpressApplication.getApplication();
    DefaultBandwidthMeter defaultBandwidthMeter = new DefaultBandwidthMeter();
    mainHandler = new Handler();
    defaultExtractorsFactory = new DefaultExtractorsFactory();
    mediaDataSourceFactory = new DefaultDataSourceFactory(context,defaultBandwidthMeter,new OkHttpDataSourceFactory(new OkHttpClient.Builder().build(),"Tumbviewer"),CacheControl.FORCE_NETWORK));
    TrackSelection.Factory factory = new AdaptiveTrackSelection.Factory(defaultBandwidthMeter);
    trackSelector = new DefaultTrackSelector(factory);
}
项目:MyAnimeViewer    文件:VideoDetailsFragment.java   
private MediaSource getMediaSource(String videoUrl) {
        DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
        // Produces DataSource instances through which media data is loaded.
//        DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(getContext(),Util.getUserAgent(getContext(),"Loop"),bandwidthMeter);
        DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(MAVApplication.getInstance().getApplicationContext(),Util.getUserAgent(MAVApplication.getInstance().getApplicationContext(),bandwidthMeter);
        // Produces Extractor instances for parsing the media data.
        ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();
        // This is the MediaSource representing the media to be played.
        MediaSource mediaSource = new ExtractorMediaSource(Uri.parse(videoUrl),null);
        // Loops the video indefinitely.
//        LoopingMediaSource loopingSource = new LoopingMediaSource(mediaSource);
        return mediaSource;
    }
项目:MyAnimeViewer    文件:OfflineVideoDetailsFragment.java   
private MediaSource getMediaSource(String videoUrl) {
        DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
        // Produces DataSource instances through which media data is loaded.
//        DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(getContext(),null);
        // Loops the video indefinitely.
//        LoopingMediaSource loopingSource = new LoopingMediaSource(mediaSource);
        return mediaSource;
    }
项目:MyAnimeViewer    文件:VideoPlayerActivity.java   
private MediaSource getMediaSource(String videoUrl) {
        DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
        // Produces DataSource instances through which media data is loaded.
//        DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this,null);
        // Loops the video indefinitely.
//        LoopingMediaSource loopingSource = new LoopingMediaSource(mediaSource);
        return mediaSource;
    }
项目:mobile-app-dev-book    文件:MediaViewActivity.java   
private void initExoPlayer() {
    DefaultBandwidthMeter bwMeter = new DefaultBandwidthMeter();
    AdaptiveTrackSelection.Factory trackFactory = new AdaptiveTrackSelection.Factory(bwMeter);
    DefaultTrackSelector trackSelector = new DefaultTrackSelector(trackFactory);
    player = ExoPlayerFactory.newSimpleInstance(this,trackSelector);
    videoView.setPlayer(player);

    DataSource.Factory dsFactory = new DefaultDataSourceFactory(getBaseContext(),"Traxy"),bwMeter);
    ExtractorsFactory exFactory = new DefaultExtractorsFactory();
    Uri mediaUri = Uri.parse(entry.getUrl());
    MediaSource videoSource = new ExtractorMediaSource(mediaUri,dsFactory,exFactory,null);
    player.prepare(videoSource);
}

com.intellij.util.xml.impl.ConvertContextFactory的实例源码

com.intellij.util.xml.impl.ConvertContextFactory的实例源码

项目:intellij-ce-playground    文件:DomElementAnnotationHolderImpl.java   
private LocalQuickFix[] getQuickFixes(final GenericDomValue element,PsiReference reference) {
  if (!myOnTheFly) return LocalQuickFix.EMPTY_ARRAY;

  final List<LocalQuickFix> result = new SmartList<LocalQuickFix>();
  final Converter converter = WrappingConverter.getDeepestConverter(element.getConverter(),element);
  if (converter instanceof ResolvingConverter) {
    final ResolvingConverter resolvingConverter = (ResolvingConverter)converter;
    ContainerUtil
      .addAll(result,resolvingConverter.getQuickFixes(ConvertContextFactory.createConvertContext(DomManagerImpl.getDomInvocationHandler(element))));
  }
  if (reference instanceof LocalQuickFixProvider) {
    final LocalQuickFix[] localQuickFixes = ((LocalQuickFixProvider)reference).getQuickFixes();
    if (localQuickFixes != null) {
      ContainerUtil.addAll(result,localQuickFixes);
    }
  }
  return result.isEmpty() ? LocalQuickFix.EMPTY_ARRAY : result.toArray(new LocalQuickFix[result.size()]);
}
项目:intellij-ce-playground    文件:AndroidResourceReference.java   
@Override
@NotNull
public Object[] getvariants() {
  final Converter converter = WrappingConverter.getDeepestConverter(myValue.getConverter(),myValue);
  if (converter instanceof EnumConverter || converter == AndroidDomUtil.BOOLEAN_CONVERTER) {
    if (DomCompletionContributor.isSchemaEnumerated(getElement())) return ArrayUtil.EMPTY_OBJECT_ARRAY;
  }
  if (converter instanceof ResolvingConverter) {
    final ResolvingConverter resolvingConverter = (ResolvingConverter)converter;
    ArrayList<Object> result = new ArrayList<Object>();
    final ConvertContext convertContext = ConvertContextFactory.createConvertContext(myValue);
    for (Object variant : resolvingConverter.getvariants(convertContext)) {
      String name = converter.toString(variant,convertContext);
      if (name != null) {
        result.add(ElementPresentationManager.getInstance().createVariant(variant,name,resolvingConverter.getPsiElement(variant)));
      }
    }
    return result.toArray();
  }
  return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
项目:tools-idea    文件:DomElementAnnotationHolderImpl.java   
private LocalQuickFix[] getQuickFixes(final GenericDomValue element,localQuickFixes);
    }
  }
  return result.isEmpty() ? LocalQuickFix.EMPTY_ARRAY : result.toArray(new LocalQuickFix[result.size()]);
}
项目:consulo-xml    文件:DomElementAnnotationHolderImpl.java   
private LocalQuickFix[] getQuickFixes(final GenericDomValue element,localQuickFixes);
    }
  }
  return result.isEmpty() ? LocalQuickFix.EMPTY_ARRAY : result.toArray(new LocalQuickFix[result.size()]);
}
项目:intellij-ce-playground    文件:DimensionConverterTest.java   
public void test() {
  DimensionConverter converter = new DimensionConverter();
  StyleItem element = createElement("<item>10dp</item>",StyleItem.class);

  DomInvocationHandler handler = DomManagerImpl.getDomInvocationHandler(element);
  assertNotNull(handler);
  ConvertContext context = ConvertContextFactory.createConvertContext(handler);

  List<String> variants = new ArrayList<String>(converter.getvariants(context));
  Collections.sort(variants);
  assertEquals(Arrays.asList("10dp","10in","10mm","10pt","10px","10sp"),variants);

  // Valid units
  assertEquals("1dip",converter.fromString("1dip",context));
  assertEquals("1dp",converter.fromString("1dp",context));
  assertEquals("1px",converter.fromString("1px",context));
  assertEquals("1in",converter.fromString("1in",context));
  assertEquals("1mm",converter.fromString("1mm",context));
  assertEquals("1sp",converter.fromString("1sp",context));
  assertEquals("1pt",converter.fromString("1pt",context));

  // Invalid dimensions (missing units)
  assertNull(converter.fromString("not_a_dimension",context));
  assertNull(converter.fromString("",context));
  assertEquals("Cannot resolve symbol ''",converter.getErrorMessage("",context));
  assertNull(converter.fromString("1",context));
  assertEquals("Cannot resolve symbol '1'",converter.getErrorMessage("1",context));
  assertNull(converter.fromString("1.5",context));
  assertEquals("Cannot resolve symbol '1.5'",converter.getErrorMessage("1.5",context));

  // UnkNown units
  assertNull(converter.fromString("15d",context));
  assertEquals("UnkNown unit 'd'",converter.getErrorMessage("15d",context));
  assertNull(converter.fromString("15wrong",context));
  assertEquals("UnkNown unit 'wrong'",converter.getErrorMessage("15wrong",context));

  // normal conversions
  assertEquals("15px",converter.fromString("15px",context));
  assertEquals("15",DimensionConverter.getIntegerPrefix("15px"));
  assertEquals("px",DimensionConverter.getUnitFromValue("15px"));

  // Make sure negative numbers work
  assertEquals("-10px",converter.fromString("-10px",context));
  assertEquals("-10",DimensionConverter.getIntegerPrefix("-10px"));
  assertEquals("px",DimensionConverter.getUnitFromValue("-10px"));

  // Make sure decimals work
  assertEquals("1.5sp",converter.fromString("1.5sp",context));
  assertEquals("1.5",DimensionConverter.getIntegerPrefix("1.5sp"));
  assertEquals("sp",DimensionConverter.getUnitFromValue("1.5sp"));
  assertEquals(".5sp",converter.fromString(".5sp",context));
  assertEquals(".5",DimensionConverter.getIntegerPrefix(".5sp"));
  assertEquals("sp",DimensionConverter.getUnitFromValue(".5sp"));

  // Make sure the right type of decimal separator is used
  assertNull(converter.fromString("1,5sp",context));
  assertEquals("Use a dot instead of a comma as the decimal mark",converter.getErrorMessage("1,context));

  // Documentation
  assertEquals("<html><body>" +
               "<b>Density-independent Pixels</b> - an abstract unit that is based on the physical density of the screen." +
               "</body></html>",converter.getDocumentation("1dp"));
  assertEquals("<html><body>" +
               "<b>Pixels</b> - corresponds to actual pixels on the screen. Not recommended." +
               "</body></html>",converter.getDocumentation("-10px"));
  assertEquals("<html><body>" +
               "<b>Scale-independent Pixels</b> - this is like the dp unit,but " +
               "it is also scaled by the user's font size preference." +
               "</body></html>",converter.getDocumentation("1.5sp"));
}

关于使用JSF的Spring Boot;找不到工厂javax.faces.context.FacesContextFactory的备份org.slf4j.loggerfactory 找不到的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于com.facebook.presto.spi.connector.ConnectorContext的实例源码、com.facebook.presto.spi.ConnectorFactory的实例源码、com.google.android.exoplayer2.extractor.DefaultExtractorsFactory的实例源码、com.intellij.util.xml.impl.ConvertContextFactory的实例源码等相关知识的信息别忘了在本站进行查找喔。

本文标签: