Is it possible to detect if a video is a Youtube Red video using the Youtube Data Api? The "kind" property on these videos are "youtube#video" just like all other videos and I can't find any way to distinguish them.
Not a perfect solution but you could listen to the state changes via onStateChange event. When a Youtube Red video loads, it goes from 3 (Buffering) to -1 (Unstarted). That was a good enough indication for me.
if (prevState === 3 && nextState === -1) {
// Handle YT Red video (in my case, skip)
}
Related
I am using AVPlayer to play a video from an https url with a setup this:
player = AVPlayer(url: URL(string: urlString))
player?.automaticallyWaitsToMinimizeStalling = false
But since the video is a little long, there is a short blank screen delay before the video actually starts to play. I think this is because it is being loaded from https.
Is there anyway to remove that delay by making AVPlayer play the video right away without loading the whole thing?
I added .automaticallyWaitsToMinimizeStalling but that does not seem to make a difference.
If anyone has any other suggestions please let me know.
I don't think there is nothing to do with loading from https. what is your video file format? I think you are thinking of adaptive bitrate streaming behavior.
https://en.wikipedia.org/wiki/Adaptive_bitrate_streaming#Apple_HTTP_Live_Streaming
HTTP Live Streaming (HLS) is an HTTP-based media streaming
communications protocol implemented by Apple Inc. as part of QuickTime
X and iOS. HLS supports both live and Video on demand content. It
works by breaking down streams or video assets into several small
MPEG2-TS files (video chunks) of varying bit rates and set duration
using a stream or file segmenter. One such segmenter implementation is
provided by Apple.[29] The segmenter is also responsible for producing
a set of index files in the M3U8 format which acts as a playlist file
for the video chunks. Each playlist pertains to a given bitrate level,
and contains the relative or absolute URLs to the chunks with the
relevant bitrate. The client is then responsible for requesting the
appropriate playlist depending on the available bandwidth.
For more information about HTTP Live Streaming
https://developer.apple.com/documentation/http_live_streaming
This tutorial includes some experiments on HTTP Live Streaming version and Non-HTTP Live Streaming version.
https://www.raywenderlich.com/5191-video-streaming-tutorial-for-ios-getting-started
Have you tried using AVPlayerItem's preferredForwardBufferDuration? You can manage how long AVPlayer continues to buffer using this property.
player.currentItem?.preferredForwardBufferDuration = 1
From Apple's own documentation:
The duration the player should buffer media from the network ahead of the playhead to guard against playback disruption.
This property defines the preferred forward buffer duration in seconds. If set to 0, the player will choose an appropriate level of buffering for most use cases. Setting this property to a low value will increase the chance that playback will stall and re-buffer, while setting it to a high value will increase demand on system resources.
Suggestion:
As a video is streaming, we are also relying on a network connection. So for poor network connection, It always has a chance to display a blank screen.
We can do like, We can fetch thumbnail of streaming video on the previous screen from the server or can generate thumbnail from application side from streaming URL. When streaming screen open, display thumbnail to a user with streaming indicator and when video starts streaming hide thumbnail.
In that particular case you can place an UIImageView above to the AVPLayerlayer view.
That image work as a landscape/cover image of your video which matched the first frame of your video along an UIActivityIndicator on subview.
Now hide that image when video got about to play.
This helps to hide the black frame of your video as it inevitable to handle the initial buffer state of the video.
I am currently using VlcControl ( Vlc.DotNet.Forms ) to play the video in latest VLC Media player using rtsp url in
c# code _videoControl.Play(new Uri(networkUrl), options);
The issue here is ,the video is not playing in default Video Track 1 but it is playing in Video Track 2.
Is there any way to set the Video Track to 1?
Kindly let me know if any options available to set the video track and play.
You can use this to select the track you want to play :
(disclaimer : I'm on my phone and I didn't test the code)
mediaPlayer.SetMedia(...);
mediaPlayer.Parse();
var videoTracks = mediaPlayer.Video.Tracks.All.ToArray();
mediaPlayer.Video.Tracks.Current = videoTracks[0];
mediaPlayer.Play();
The same can be achieved with Audio for audio tracks
Looking for a simple example that casts a youtube video and how to control it, pause, play, volume, skip, etc
I have managed to display a YouTube video in MPMoviePlayerController. Now I want to set different quality of the video just as YouTube has done it.
I am using LBYoutubeextractor to display video in MPMoviePlayer from youtube.
As in the image above, I want to enable the user to change video quality by clicking on various pixel options, like 1080pHD, 720pHD, etc.
How do I achieve this?
Well I have a burning issue, with the iPad.. more specifically Safari on the iPad.
The tag doesn't play .mov's at all and converting using Quicktime to .m4v loses my alpha layer.
Currently working with a PNG sequence but its horrible.. Is there any way I can keep my alpha channel and have the video tag work?
Many thanks!
Dave
html5-video is able to play mov-files! usually this happens, if the server isn t well configured with the MIME-type of the video. check my answer here Playing a movie/DVD on a website maybe this solves your mov problem and you don t have to use .m4v at all
it turned out that the iPad doesn't support the alpha channel (or at least every method and format I tried wouldn't work) and it wouldn't play the video because Apple have disabled the autoplay attribute
But I did make a workaround, there appears to be a buffer at page load in which you can start the play() function on a video and stop it meaning its ready to play. But you can only get one video in...
Bummer..