Custom action after tapping a video during the playback or when the playback ends - codenameone

My use case: I have an image that is the preview of a video. When the user tap the preview, the video should starts a fullscreen playback (I suppose in another Form). When the video ends or when the user tap the video during the playback, the previous Form should be shown. This is the same use case of the question: Codename One landscape oriented Form in a portrait locked app
My question: the MediaPlayer class doesn't seem to expose a method to perform a custom action when pressing the video or when the video ends, like requested by this use case. The MediaPlayer is a peer component, so I'm not sure if trying to use a button as a leader component can make sense to do an action after a tap. Any idea?

Unfortunately media is pretty complicated in that sense. You can either rely on the behavior of the media player natively which handles orientation change, playback etc. seamlessly (seek etc.). Or you can implement everything on your own in a media object in which case you can use native peer overlay and have a transparent component on top of the media view which will grab all the clicks.
The former will provide a more native UX and will auto-rotate the UI but we don't have control since there's no Form underlying the UI. It's shown when you invoke setNativePlayerMode(true). When you tap the video in this case it pauses. To exit playback you would use device native keys e.g. back or a done button and would be returned to the parent Form. Notice that since this is native behavior it acts differently on the device and it's important to do device testing here.
Your alternative is to place a media component in the center of the screen and then you can override everything and customize everything. You can place a layered layout on top and grab all tap events. You will need to add your own progress, play, pause etc. UI elements. The user would need to physically rotate the device as orientation won't switch on its own (for the most part).

Related

Implementing Mobile Controls into React Three Fiber

I'm currently trying to create a desktop AND mobile experience using React Three Fiber, using this example as a boilerplate: https://codesandbox.io/s/vkgi6. For mobile I've managed to create some buttons which simulate pointerControls interactions for panning the camera.
The problem now, is simulating key presses (such as spacebar); I can't seem to add a ref to Keyboard Controls, and I've tried doing something like this:
How to trigger keypress event in React.js and using ref.dispatchEvent connected to the <App> container itself, but to no avail.
Any suggestions for how to simulate keypresses which get picked up by the Player component (such as Space for causing the player to jump)? Alternatively, anyone know of any great 'dual' joystick control examples for mobile, with one for moving and one for panning?
Thanks

Correct way to add custom buttons with OpenTok

I'm building a video application for the web in React using OpenTok. OpenTok has built in buttons for muting the mic for the publisher and muting the audio for subscribers. In my case I also need buttons to mute the video for both the publisher and the subscriber.
I haven't seen anything about a mute video button in the documentation so I built the functionality myself using subscribeToVideo. The problem is that I want to add a button with this functionality next to the mute audio button, but I haven't found anything about custom buttons in the documentation.
So my question is: What's the best way to add custom buttons to OpenToks bar?
Of course I could append a button to the html and style it in place myself, but it feels ugly and I don't know what the consequences are. I guess this is my back up solution if there isn't any other way.
I will probably need to add other buttons as well in the future so I really hope OpenTok supports custom buttons and that it's just me that haven't found how to do it.
TokBox Developer Evangelist here.
We don't have any documentation on custom buttons, but you do have three options for the video and mute buttons on the video element.
If you want a custom button, you will have to append that to the HTML and toggle subscribeToVideo and subscribeToAudio properties like you said.
Here is a react sample that adds a mute video button https://opentok.github.io/opentok-web-samples/React-Basic-Video-Chat/
I would recommend that you just set the buttonDisplayMode to off and then recreate the mute audio button just using subscriber.subscribeToAudio() and publisher.publishAudio(). This way if eg. the opentok UI changes slightly it doesn't matter for you, plus you can make it all look however you want.

In React Native, how do you make an interactive tap-and-hold modal like Instagram?

Instagram has a really cool interaction where you can tap-and-hold, aka longPress, on an image and an interactive pop-up appears. Once it appears you can drag your finger to one of the action buttons and removing your finger applies the action and closes the pop-up.
Here it is in action.
And here's a link to a video if you need a closer look.
In my app I've got the tap-and-hold popup working, but the finger drag continues to control the underlying View.
How do you get the finger interaction to transfer to the pop-up?
How do you get the buttons responding to finger drag-over?
This is something you can achieve with PanResponder. Using Pan Responder you are basically creating your own touchable components. Click here for the docs.
Also, you would need the Animated API for animating the transitions.

PLAY_VIDEO menu item does not autoplay

i just implemented the PLAY_VIDEO menu item linked to a youtube video and it works.
The only enhancement i want to make to the flow is to remove one tap in order to stream the video.
Now the flow is the following:
1) User taps to prompt the menu for the card. The PLAY menu item appears.
2) The user taps on PLAY, the video start to load
3) The user needs to tap again to start the video.
Is there a way to stream the video right after the tap from point 2?
Kind regards
There is currently no way to setup a menu hierarchy, which I think is what you're getting at.
Plus, having that extra tap would be an inconsistent experience with the way playback behaves on Glass in the native app and other apps being created.
Why do you want to do the extra tap?

Camera customization sencha touch

I'm using the Ext.device.Camera component to take photos in my sencha touch app. I'd like to change some things of this component:
Change the text of the buttons retake and use
Add a button to show the camera roll (The camera roll view is ready, so the button will only change the view)
After the call at success function I would like that the camera won't close and it gives the possibility to the user to take another photo
Thanks
You cant do that from ST2. That's native stuff, if you are wrapping with phonegap/cordova you could create a custom plugin.

Resources