mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[freeboxos] Fix media playing (#17244)
Fix #17243 Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
parent
c2613c7759
commit
0e4ce596d6
@ -54,8 +54,11 @@ public class MediaReceiverManager extends ListableRest<Receiver, MediaReceiverMa
|
|||||||
UNKNOWN
|
UNKNOWN
|
||||||
}
|
}
|
||||||
|
|
||||||
private static record Request(String password, Action action, MediaType mediaType, @Nullable String media,
|
private static record Request(String password, String action, String mediaType, @Nullable String media,
|
||||||
int position) {
|
int position) {
|
||||||
|
Request(String password, Action action, MediaType mediaType, @Nullable String media, int position) {
|
||||||
|
this(password, action.name().toLowerCase(), mediaType.name().toLowerCase(), media, position);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MediaReceiverManager(FreeboxOsSession session, UriBuilder uriBuilder) throws FreeboxException {
|
public MediaReceiverManager(FreeboxOsSession session, UriBuilder uriBuilder) throws FreeboxException {
|
||||||
@ -77,6 +80,6 @@ public class MediaReceiverManager extends ListableRest<Receiver, MediaReceiverMa
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendToReceiver(String receiver, Request payload) throws FreeboxException {
|
private void sendToReceiver(String receiver, Request payload) throws FreeboxException {
|
||||||
post(payload, GenericResponse.class, receiver);
|
post(payload, receiver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import java.util.List;
|
|||||||
import javax.ws.rs.core.UriBuilder;
|
import javax.ws.rs.core.UriBuilder;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.freeboxos.internal.api.FreeboxException;
|
import org.openhab.binding.freeboxos.internal.api.FreeboxException;
|
||||||
import org.openhab.binding.freeboxos.internal.api.PermissionException;
|
import org.openhab.binding.freeboxos.internal.api.PermissionException;
|
||||||
import org.openhab.binding.freeboxos.internal.api.Response;
|
import org.openhab.binding.freeboxos.internal.api.Response;
|
||||||
@ -83,7 +84,11 @@ public class RestManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void post(String... pathElements) throws FreeboxException {
|
protected void post(String... pathElements) throws FreeboxException {
|
||||||
session.execute(buildUri(pathElements), POST, GenericResponse.class, null);
|
post(null, pathElements);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <F> void post(@Nullable F payload, String... pathElements) throws FreeboxException {
|
||||||
|
session.execute(buildUri(pathElements), POST, GenericResponse.class, payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected <F, T extends Response<F>> F put(Class<T> clazz, F payload, String... pathElements)
|
protected <F, T extends Response<F>> F put(Class<T> clazz, F payload, String... pathElements)
|
||||||
|
@ -118,8 +118,7 @@ public abstract class ApiConsumerHandler extends BaseThingHandler implements Api
|
|||||||
private void startAudioSink(Receiver receiver) {
|
private void startAudioSink(Receiver receiver) {
|
||||||
FreeboxOsHandler bridgeHandler = checkBridgeHandler();
|
FreeboxOsHandler bridgeHandler = checkBridgeHandler();
|
||||||
// Only video and photo is supported by the API so use VIDEO capability for audio
|
// Only video and photo is supported by the API so use VIDEO capability for audio
|
||||||
Boolean isAudioReceiver = receiver.capabilities().get(MediaType.VIDEO);
|
if (reg == null && bridgeHandler != null && Boolean.TRUE.equals(receiver.capabilities().get(MediaType.VIDEO))) {
|
||||||
if (reg == null && bridgeHandler != null && isAudioReceiver != null && isAudioReceiver.booleanValue()) {
|
|
||||||
ApiConsumerConfiguration config = getConfig().as(ApiConsumerConfiguration.class);
|
ApiConsumerConfiguration config = getConfig().as(ApiConsumerConfiguration.class);
|
||||||
String callbackURL = bridgeHandler.getCallbackURL();
|
String callbackURL = bridgeHandler.getCallbackURL();
|
||||||
if (!config.password.isEmpty() || !receiver.passwordProtected()) {
|
if (!config.password.isEmpty() || !receiver.passwordProtected()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user