Class StreamingProvidersRegistry
- java.lang.Object
-
- org.silverpeas.core.media.streaming.StreamingProvidersRegistry
-
@Singleton public class StreamingProvidersRegistry extends Object
Register of all streaming providers handled into Silverpeas.This permits also to control which streaming providers are allowed into Silverpeas.
- Author:
- silveryocha
-
-
Constructor Summary
Constructors Constructor Description StreamingProvidersRegistry()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(StreamingProvider streaming)
Adds aStreamingProvider
instance into registry.static StreamingProvidersRegistry
get()
Set<StreamingProvider>
getAll()
Optional<StreamingProvider>
getByName(String name)
Gets by name (which is considered as the identifier) the registeredStreamingProvider
instance if any.Optional<StreamingProvider>
getFromUrl(String streamingUrl)
Gets the registeredStreamingProvider
instance matching with the given full URL of a streaming.Optional<String>
getOembedUrl(String streamingUrl)
Gets the oembed url from the full URL of a streaming.protected void
setupDefaults()
The registry is filled by default from 'org.silverpeas.media.streaming.properties' file definitions.
-
-
-
Method Detail
-
get
public static StreamingProvidersRegistry get()
-
setupDefaults
@PostConstruct protected void setupDefaults()
The registry is filled by default from 'org.silverpeas.media.streaming.properties' file definitions.In order to handle other streaming providers, the property file MUST be completed. Or it is also possible to an additional library to add programmatically an other streaming provider.
-
getAll
public Set<StreamingProvider> getAll()
-
getByName
public Optional<StreamingProvider> getByName(String name)
Gets by name (which is considered as the identifier) the registeredStreamingProvider
instance if any.- Parameters:
name
- a Silverpeas's identifier of streaming provider which is represented the name of the streaming provider.- Returns:
- the aimed
StreamingProvider
is any.
-
add
public void add(StreamingProvider streaming)
Adds aStreamingProvider
instance into registry.- Parameters:
streaming
- the streaming provider definition.
-
getFromUrl
public Optional<StreamingProvider> getFromUrl(String streamingUrl)
Gets the registeredStreamingProvider
instance matching with the given full URL of a streaming.- Parameters:
streamingUrl
- the full URL of a streaming.- Returns:
- a
StreamingProvider
instance if any guessed from the given URL.
-
getOembedUrl
public Optional<String> getOembedUrl(String streamingUrl)
Gets the oembed url from the full URL of a streaming.oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.
All streaming providers implementing oembed services are listed here: https://oembed.com/providers.json
- Parameters:
streamingUrl
- the full url of a streaming.- Returns:
- the oembed url as string.
-
-