I am automating android app using Appium (java).
I have android.widget.VideoView on the page and using verifyElementByClass , I can check whether the Video View exists on that page.Now I need to check if it is playing any video or not? How to do that?
Asserting the elements pause_button , seekbar etc. depicts that the video is being played. According to the comment :
the pause button seekbar etc are coming as overlay but UIAutomator is
unable to capture it as it stays for very less time
One way to perform the action is to tap on the android.widget.VideoView and then Assert the presence of the elements so that the overlay is present while you are asserting.
Other way I would have suggested to properly validate if the video is actually getting played is the comparison of screenshots at different timestamps using OCR which is yet not implemented in Appium. These might be of help for Screenshots and OCR-Apppium.
Related
I'm doing an App for android using delphi FMX and TWebbrowser, the user would select a video from the listview which will then playback the video in a TWebbrowser control, the problem I'm facing is, even if the video is a youtube video as an example, I press on the maximize symbol, the video wont go fullscreen, nothing changes. is the a work around or am I doing something wrong. thanks. I'm using delphi 10.3.3
You're not doing anything wrong - TWebBrowser needs to use a descendant of WebChromeClient (something that must be done in Java) that implements certain methods, as per this article:
https://medium.com/#oliverdamjan2013/fullscreen-youtube-video-in-webview-android-21f1c778cf56
I do something similar in this demo:
https://github.com/DelphiWorlds/Kastri/tree/master/Demos/WebBrowserFileChooser
Which makes use of a descendant of WebChromeClient that implements onShowFileChooser. The folder that has the Java code is here:
https://github.com/DelphiWorlds/Kastri/tree/master/Java/WebChromeClient
The code could be extended to implement the necessary methods (onShowCustomView etc) as per the other article linked to.
EDIT 10-NOV-2020
I've now updated the underlying Java code and updated the demo here:
https://github.com/DelphiWorlds/Kastri/tree/master/Demos/WebBrowserFileChooser
(rather than create a whole new demo)
To support viewing YouTube videos full screen. Please note that the demo relies on files in the Kastri library
I need to know how to provide an HTML video player type functionality where we can hide the progress bar and only interaction allowed is to start and stop.
I want to add functionality to flutter where user can visit a video, start or pause the video as per their convenience. as they might need to add some instructions before the video play. I don't want the video to start immediately to play on loading the screen.
one last thing. there is an intro to the video which is common to all videos so how can we have a skip intro button so that users can skip the intro when they know that its common part an can be skipped.
the issue with HTML video player for the app is that the user can skip the entire video and complete that module. which we don't want as it defeats the whole purpose of the app.
I saw this app and found it a really good challenge to test this particular task but I have never implemented video and audio in flutter before as i am too a beginner.
summary:
user can start and stop/pause the video on their own will.
user can skip the video to a certain seconds like 50 sec as that part is intro.
progress bar for video needs to be hidden or in some way we can stop user interaction so that they cannot skip the entire video.
You could use the Video Player plugin for Flutter
The VideoPlayerController has these methods:
play()
pause()
seekTo(Duration)
And these properties:
value.duration
value.position
You have more methods and properties, but with these mentioned and the example provided by the plugin I think you could get an idea to achieve what you want.
I'd like to implement bookmarks app allowing to save a bookmark for a particular moment in a youtube video so that it would be possible to jump back to the given second of the video.
I'd like it to be seamlessly integrated with the native youtube app. Is it possible to create a transparent layer on top of youtube app so that I could add this kind of functionality? I mean kind of button in the corner of the screen allowing to save the exact moment of the video. To do that I need to know what youtube video is being watched and what is the moment? Is it doable?
I have no experience with android development, but I'm a skilled Java programmer.
This is a link to a youtube video which takes you directly to a certain moment in the video: https://theyoutubevideolink?t=36m42s (Note everything after ?)
This also works on the current Android YouTube App you can click on the link and it will directly take you to the moment. So it is possible to simply save that link to an external overlay/database.
But before thinking about that you understand Root permission is needed to be able to do this as an overlay. If you are fine with this, it is doable there are many open source YouTube apps with changes made to them on XDA Developers for example, and a simple database addition can the trick for this.
[EDIT]
Well I just went on the YouTube app and you cant hold a time-link like for example on LinusTechTips new video on mobile if you scroll down to the comments you will see many comment showing 0:55 which if you click on can take you directly to that moment in the video. Because we cant hold or anything else than just click, You will need to re-write so you can highlight etc.. which is why i mentioned before about having root access since you cant install third party YouTube apps it has to be re-written and just made into another app. To start you off check this re-written YouTube app called SkyTube: https://github.com/ram-on/SkyTube
I'm trying to make a kid-safe youtube player (users can't easily watch unapproved content). Using the CHROMELESS style almost gets there, but users can still click the lower banners or 'Watch Next' button that pops on the video. This takes them to the Youtube app where they could browse to any video.
Similar questions that I've found without resolutions:
how to remove bottom overlay ads from custom youtube player Android
Is there any way to disable "Watch Next" block at the end of video using YouTube Android Player API?
Someone in the second thread suggested using "a ViewTreeObserver and hiding that particular view", but I am having trouble getting that to work.
-Hello! Please correct me if i am wrong but this line of code may be helpful to you i think player.setPlayerStyle(PlayerStyle.MINIMAL);
-Try this line this may will sure solve your problem :-
player.setPlayerStyle(PlayerStyle.CHROMELESS);
In case anyone is still stuck with this, here is what worked for me. If you are only playing a single video then cue the video when playing is finished but don't call player.play() unless you want to repeat the video.
if(player.getCurrentTimeMillis()>=player.getDurationMillis())
{
player.cueVideo(CurrentVideoUrl);
}
If you are providing a long list of videos that play one after the other then use an array list
if(player.getCurrentTimeMillis()>=player.getDurationMillis())
{
CurrentVideoIndex++;
CurrentVideoUrl =videosListArray.get(CurrentVideoIndex).getVideoUrl();
player.cueVideo(CurrentVideoUrl);
}
I´m using Delphi XE5 for an app that creates an .avi video file for the user.
After successfully creating it (or even just because the user wants to watch the video again) it tries to open it using the app of choice for videos.
I understand that android picks the right app for the file type or you can direct it providing the MIME type of the file.
So, using intents from Delphi I´m doing
intent:=TJIntent.Create;
intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
intent.setData(TJnet_Uri.JavaClass.parse(StringToJString('file://'videoFile)));
intent.setType(StringToJString('video/avi'));
When I do this, a very basic video player appears (the Running Apps section of Setting show an app called Android Media running) with a play button but does not show the video.
But if you use any File Manager or even go through the Gallery and click on the file it plays nicely using the View Video app.
I can´t make my app call View Video directly, not even show a list of video apps for the user to choose it.
I tried different MIME types like
intent.setType(StringToJString('video/*'));
and even
intent.setType(StringToJString('*/*'));
Which lets the user choose from any app in its device (nosense but just for testing) so he can choose View Video but even doing that the app shows only a play button and displays no content when pressed.
So, it looks like when called from my app, View Video can´t play the video I created (I do not have it opened or something like that, checked) but when called from other apps it can.
Does anybody know of bugs or limitations when using intents from Delphi XE5 or maybe I´m not doing it right?
intent.settype in Delphi XE5 was ruining the contents of the data property.
Using another setter like SetDataAndType works well. Use that one!
Not sure if they fixed it in XE6 or XE7.