How to continue load video after Internet Connection in Exoplayer Android - exoplayer2.x

I need resume load video in exoplayer android kotlin after network connection.
override fun onPlaybackStateChanged(playbackState: Int) {
super.onPlaybackStateChanged(playbackState)
}
override fun onPlayerErrorChanged(error: PlaybackException?) {
super.onPlayerErrorChanged(error)
}

Related

Network Client use wrong input devices when using Unity.Netcode with Starter Asset Controller (New input system)

The server is always using Keyboard and Mouse just fine.
The client however always use "xbox controller" instead of Keyboard & Mouse:
The following is the inspector view as a client:
The Start Asset input action are unchanged,
This is what I tried but client is still being assigned to controller:
private void Start()
{
if (!IsOwner)
{
Destroy(GetComponent<PlayerInput>());
}
}
How could I fix this? Other than hard coding (PlayerInput)map.SwitchCurrentControlScheme("KeyboardAndMouse");?
This issue is fixed by disabling Player Input script.
And only enable it on Network Spawn.
public override void OnNetworkSpawn()
{
base.OnNetworkSpawn();
if (IsOwner)
{
_playerInput = GetComponent<PlayerInput>();
_playerInput.enabled = true;
}
}

Can't stop audio playback on iOS with Codename One

My Codename One app features audio playback in the background when the user taps the screen. The audio I use is an mp3. Here is how I use the Media playback :
public static void playSound(boolean stop) {
sound.reset(); // The input stream needs to go back to the beginning
Media myClip = MediaManager.createMedia(sound, "audio/mp3", () -> {
// If there is no order to stop playback, we keep playing when it has completed (looping)
playSound(false);
});
if (!stop) {
myClip.play();
} else {
myClip.cleanup();
}
}
So hen the user taps the screen components change and I pass true to playSound method. On Android the current playback stops not on iOS with an iPhone 4.
Please note that when the app gets minimized (center button pressed) the playback stops (even if I don't call cleanup() on the Media which I do on Android to stop the playback when the app is minimized).
How can I stop the playback on iPhone ?
Any help appreciated,
#Shai pointed me to the right direction so here is the code finally used :
Media myClip = null;
public static void playSound(boolean stop) {
sound.reset(); // The input stream needs to go back to the beginning
/**
* If the media is playing we don't create it
* otherwise we would have several media in the wild
* that could not be stopped
*/
if (myClip == null || !myClip.isPlaying()) {
myClip = MediaManager.createMedia(sound, "audio/mp3", () -> {
// If there is no order to stop playback, we keep playing when it has completed (looping)
playSound(false);
});
}
if (!stop) {
myClip.play();
} else {
myClip.cleanup();
}
}

How to control AVAudioPlayer using earPods remote control?

I'm using AVAudioPlayer to play music
I want to control playing from remote controls which are part of using headphones.
I've already this:
override func remoteControlReceivedWithEvent(event: UIEvent?) {
let rc = event!.subtype
print(rc.rawValue)
//rc.rawValue: 101 = pause, 100 = play
switch rc {
case .RemoteControlPlay:
playButtonClicked("")
case .RemoteControlPause:
pauseButtonClicked("")
default:break
}
}
It's working great from this menu
But clicks on headphones are ignored. How can I fix it?
I believe that the headphones send the TogglePlayPauseCommand event:
https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPRemoteCommandCenter_Ref/index.html#//apple_ref/occ/instp/MPRemoteCommandCenter/togglePlayPauseCommand
Because I see you're using Xamarin, RemoteControlTogglePlayPause should be of interest
https://developer.xamarin.com/api/type/MonoTouch.UIKit.UIEventSubtype/

html5 audio tag playing audio when it is load audio

i have html5 audio player like play, pause, stop buttons.
function onUpdate()
{
var isPlaying = (!getAudioElement().paused);
document.getElementById("playerplay").style.display = (isPlaying)?"none":"block";
document.getElementById("playerpause").style.display = (isPlaying)?"block":"none";
};
function getAudioElement()
{
return document.getElementById("id_audio_element");
}
function play() {
getAudioElement().play();
onUpdate();
}
function pause() {
getAudioElement().pause();
onUpdate();
}
function stop() {
getAudioElement().pause();
getAudioElement().currentTime=0;
onUpdate();
getAudioElement().load();
}
And audio tag:
<audio id="id_audio_element" onended="onUpdate();load();"><source src="105.ogg" type="audio/ogg"></audio>
it works all on browsers perfectly, exept iPhone and iPad's Safari and Chrome. When I call load() , audio starts playing, although I don't call play().
Anybody has a solution? Thanks!
If the source is not changing, there is no need to call load(). If it is changing, try calling pause() after it loads.

corona sdk iphone 4s 5.1.1 no sound

I don't have sound in apps on iphone 4s 5.1.1
tested my app + 2 (unmodified)examples from sample code
even when i send notifications - i get vibration (if with sound) - without sound i don't get vibration but in both cases sound does not play. not it notification not in app
Help!
I tried using ggmusic and ggsound libs by Glitched Games. Both of witch implement the new audio api.
here is some code so i meet the QUALITY STANDARTS
local supportedAudio = {
["Simulator"] = { extensions = { ".aac", ".aif", ".caf", ".wav", ".mp3", ".ogg" } },
["IOS"] = { extensions = { ".aac", ".aif", ".caf", ".wav", ".mp3" } },
["Android"] = { extensions = { ".wav", ".mp3", ".ogg" } },
}
Ok guyz, the thing is - you should check that switch on the right side that turns off sounds. Your media playback will play via loudspeker, but sounds dont. Turn sounds on and it fixes it.
Lame apple user I am.
Cheers!