-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Android: app crashes #6
Comments
Thx, but it still crashes: FATAL EXCEPTION: main
Process: app.wako, PID: 10333
java.lang.IllegalArgumentException: No view found for id 0x7f0a000c (app.wako:id/MediaPlayerFragmentContainerView) for fragment MediaPlayerContainer{e5cdb60} (44a34cbd-cbe9-4c0e-ae50-c0ffbaa7887d id=0x7f0a000c tag=rwfyig0iilo)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:547)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1839)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:224)
at android.os.Looper.loop(Looper.java:318)
at android.app.ActivityThread.main(ActivityThread.java:8772)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
Moreover I had to set default value for top, start, width... otherwise it throw a null pointer exception |
@JumBay Sorry, for the delay, v2.0.6 should fix these issues. |
@JumBay , please let me know if the issue is fixed. |
Thx I've been busy lately, I'll check it soon |
@JumBay , I have made more changes since v2.0.6 you should give a try and let me know if everything is working. |
Hi, Sorry for the delay. So I've been able to try the latest version (3.1.0) on my app wako.app but it still crashes:
Here is the code I use: import { MediaPlayer, MediaPlayerOptions } from '@eduardoroth/media-player';
import { OpenMedia, VideoPlayerEvents } from '@wako-app/mobile-sdk';
import { Subject } from 'rxjs';
export class WakoVideoPlayerExtendedV2Service {
static async openVideoUrl({
videoUrl,
startAt = 0,
openMedia,
title,
poster,
}: {
videoUrl: string;
startAt?: number;
openMedia?: OpenMedia;
title?: string;
poster?: string;
subtitle?: string;
}): Promise<VideoPlayerEvents> {
const playerId = 'fullscreen';
const options: MediaPlayerOptions = {
playerId,
url: `https://archive.org/download/BigBuckBunny_328/BigBuckBunny_512kb.mp4`,
placement: {
videoOrientation: 'HORIZONTAL',
},
extra: {
title: 'Test Title',
subtitle: 'Test Subtitle',
poster: 'https://image.tmdb.org/t/p/w342/nw2jRlCbBapEsRAMtsLONBbqXxp.jpg',
autoPlayWhenReady: false,
showControls: true,
},
ios: {
enablePiP: false,
fullscreenOnLandscape: true,
},
android: {
enablePiP: false,
fullscreenOnLandscape: true,
},
};
console.log('options', options);
// Initialize player with MediaPlayer plugin
await MediaPlayer.create(options);
const listeners: any[] = [];
let duration: number;
let currentTime: number;
const timeSubject = new Subject<{ currentTime: number; totalDuration: number }>();
// Setup keyboard controls
const keyupHandler = async (e: KeyboardEvent) => {
let handled = false;
switch (e.key) {
case 'MediaFastForward':
case 'ArrowRight': {
handled = true;
const result = await MediaPlayer.getCurrentTime({ playerId });
MediaPlayer.setCurrentTime({ playerId, time: result.value + 10 });
break;
}
case 'MediaRewind':
case 'ArrowLeft': {
handled = true;
const result = await MediaPlayer.getCurrentTime({ playerId });
MediaPlayer.setCurrentTime({ playerId, time: Math.max(0, result.value - 10) });
break;
}
case 'MediaPlay':
handled = true;
MediaPlayer.play({ playerId });
break;
case 'MediaPause':
handled = true;
MediaPlayer.pause({ playerId });
break;
case 'MediaPlayPause':
handled = true;
const isPlaying = await MediaPlayer.isPlaying({ playerId });
if (isPlaying.value) {
MediaPlayer.pause({ playerId });
} else {
MediaPlayer.play({ playerId });
}
break;
}
if (handled) {
e.preventDefault();
e.stopPropagation();
}
};
document.addEventListener('keyup', keyupHandler);
// Setup time update interval
const timeInterval = setInterval(async () => {
try {
if (!duration) {
const durationResult = await MediaPlayer.getDuration({ playerId });
duration = durationResult.value;
}
const currentTimeResult = await MediaPlayer.getCurrentTime({ playerId });
currentTime = currentTimeResult.value;
timeSubject.next({ currentTime, totalDuration: duration });
} catch (error) {
timeSubject.error(error);
}
}, 5000);
// Cleanup function
const cleanup = () => {
document.removeEventListener('keyup', keyupHandler);
clearInterval(timeInterval);
timeSubject.complete();
listeners.forEach((listener) => {
if (listener?.remove) {
listener.remove();
}
});
MediaPlayer.remove({ playerId });
};
const readyListener = await MediaPlayer.addListener('MediaPlayer:Ready', async () => {
debugger;
if (startAt) {
await MediaPlayer.setCurrentTime({ playerId, time: startAt });
}
await MediaPlayer.play({ playerId });
readyListener.remove();
});
listeners.push(readyListener);
// Play video
//
return {
onExit: new Promise((resolve) => {
const exitListener = MediaPlayer.addListener('MediaPlayer:Removed', () => {
cleanup();
resolve({ currentTime, percent: Math.round((currentTime / duration) * 100), openMedia });
});
const endedListener = MediaPlayer.addListener('MediaPlayer:Ended', () => {
cleanup();
resolve({ currentTime, percent: Math.round((currentTime / duration) * 100), openMedia });
});
listeners.push(exitListener, endedListener);
}),
onCurrentTime: timeSubject.asObservable(),
playerId,
} as VideoPlayerEvents;
}
static closePlayer() {
MediaPlayer.removeAll();
}
} |
@JumBay this issue is fixed in version v3.1.4 You also need to be on Gradle version 8.7, so update your
|
Hi,
Thanks for the plugin.
I did a try on android an got the error:
The code I use :
The text was updated successfully, but these errors were encountered: