I'm creating an app which will display YouTube video. I want to get the length of that video. For example: When the user watches YouTube video for 30 seconds they will get 20 points. Is there any way to get the length. Thanks in advance.
Use YouTubePlayer.getDurationMillis() to obtain the video duration in milliseconds.
Related
I am working on Android App regarding video playing. I am facing 20 to 30 seconds delay in video playing. I have tried many players but issue was always same. should i use Android custom or third party player for video playing. or anyone can suggest me alternative approach. videos size is 5mb and in mp4 format. how can i minimize this time to 1 to 2 sec.
From the description of your issue it may simply be that the metadata is at the end of the container for the video, which is typical with mp4 videos.
For video you want to stream it is recommended to move this to the front of the video.
You can see some more info and examples here:
https://superuser.com/a/438471
https://multimedia.cx/eggs/improving-qt-faststart/
I am trying to use the video ads in tight time frames so I need to know the length of the video before it is to be displayed. Is there a way to get the length of the video ad before it is displayed?
Video Ad's length is generally 30 seconds or less. Check the blog link for reasoning. https://www.adcolony.com/blog/2014/04/24/713-2/
Currently there is no API available to get this information. Can you please provide us a usecase on support#adcolony.com ?
I am playing you Tube video using Android You tube API. Some of the URL are working fine but in some URL i found error message on screen saying "There was a problem with network [400] Tap to retry". Internet is connected.Please help me out. Thanks in advance.
This link, Your solution.
I think Give ONLY the YouTube ID and not the entire YouTube URL to the loadVideo() function.
UPDATE:
if you want jump to a specific time in the video.
The API provides two methods to jump playback:
– seekToMillis() – Seeks to the specified time in the video.
– seekRelativeMillis() – Seeks forward or backwards by the specified number of seconds.
More info here
Just remove the **https://www.youtube.com/watch?v=**gNRN7lUU3tM from the url and only give gNRN7lUU3tM as url to the youtube player. It will work fine
I have online translation m3u8. This translation consist of many *.ts files, where every file is 3 seconds video segment. I want to get current played sound from this stream. I try to get sound from one *.ts and I think I can. But how I can get current segment?
Maybe somebody know the ways, how to get sound from online translaition?
I use the MediaStore to capture the video, but it will record the video upto 8 seconds only ,can anyone help me to increase the duration of video. I am using android 2.2.
See EXTRA_DURATION_LIMIT
Specify an EXTRA_DURATION_LIMIT parameter in the MediaStore.ACTION_VIDEO_CAPTURE Intent.
From StackOverflow - Max duration for capture video on android
intent.putExtra("android.intent.extra.durationLimit", 30000);