I am trying to make one app to play several videos sequentially, for it, I have seen the Katura HTML5 Video Player to do it and I would like to ask you if it is Samsung SDK compatible or it is not which HTML5 Video Player is Samsung SDK compatible?
Thanks in advance
Alejandro
A simple way to do this would be to create an array with the videos to play and utilize the OnRenderingComplete callback in the player plugin to play the next video in the array when the current video finishes. Roughly something like:
var videos = ["url1", "url2"];
function playNext() {
if (videos.length > 0) {
url = videos.shift();
player.Play(url);
} else {
//Playlist is over
}
}
player.OnRenderingComplete = 'playNext';
Related
I am developing a game for android and ios via Unity. I have to play a video in a scene in the game and I use the video player component for this. I get the video link on local using xampp. And the video I'm trying to play is in mp4 format. But when I start the game, the video cannot be played properly. I am not getting an error, but video looks like the picture I send. I don't know what I'm doing wrong, can you help me? I also share the code I used and related pictures with you.
public VideoPlayer videoplayer;
public string videoUrl="urlgir";
void Start() {
videoplayer.url = videoUrl;
videoplayer.audioOutputMode=VideoAudioOutputMode.AudioSource;
videoplayer.EnableAudioTrack (0, true);
videoplayer.Prepare (); }
I think I found something. I uploaded the video I mentioned to unity again. I got a warning after uploading the video.
VFR warning: 1111 video frames have a different duration than expected 0.0333333s, ranging from 0s to 1.2771s.D:/Program Files/Unity/xxx/Assets/Scenes/hp.mp4 (30FPS) may have variable frame rate (VFR), which is not supported. This may lead to incorrect timing in transcoded clip.
I think the video has unsupported variable frame rate. So I can't run the video as clib or url. Well, does anyone know of this warning? What should be needed?
I am trying to integrate Youtube video using youtube-ios-player-helper
This is playing youtube video with videoId properly with audio in iOS 9 (iPod).
But when I am trying to play in iOS 11 (iPhone 6) then it plays without audio.
Please help how can I resolve it?
Thanks in advance.
Thanks #RazKarapetyan.
Import AVFoundation framework.
Then before playing video set audio session category to Playback as below code: -
let audioSession = AVAudioSession.sharedInstance()
do {
try audioSession.setCategory(AVAudioSessionCategoryPlayback)
} catch {
// failed to record!
}
Its working for me.
I'm trying to play videos in Unity WebGL in the browser, but having lots of problems.
I tried two different video players and none of them work fully.
The WebGLMovieTexture player works like this
public WebGLStreamingVideoPlugin _videoPlugin = new WebGLStreamingVideoPlugin("http://www.example.net/video.mp4");
_videoPlugin.Play();
Basically when you want to play a video you create a new instance and give it the URL like above, and it plays great!!
The problem is when you want to stop that video, and play a different video, it seems impossible because there is no way dispose of the first video because there is only a Stop() in the API, which stops the playback but it continues to stream the video data from the internet in the background.
There is no way to delete the instance because Destroy() cant be called since that WebGLMovieTexture is not derived from monodevelop, and C# does not seem to give a way to delete an object (how silly). Even setting it to null doesnt do it, it continues to stream the video in the background.
So if you create a new instance in order to play a different video, you end up with TWO video streams, and if you do it again to play a third, you end up with THREE, and so on, so quickly you can see how bad that will end up.
My question is how to dispose of or destroy the first WebGLMovieTexture player, or maybe tell it to stop streaming the first video and start playing a different one?
The second player I tried is the VideoPlayer for WebGL in Unity Version 5.6.0b4, with this one I can only get it to play a video if I hardcode the URL in the inspector, if I put the URL in code it doesn't play it in the browser.
vPlayer = gameObject.GetComponent<UnityEngine.Video.VideoPlayer>();
if (vPlayer.isPlaying) {
Debug.Log("STOPPING PLAY");
vPlayer.Stop();
}
vPlayer.url = url;
vPlayer.isLooping = true;
vPlayer.frame = 0;
vPlayer.targetCameraAlpha = 1F;
vPlayer.Prepare();
vPlayer.Play();
And to get it to play a second video I suspect I will have the same problems as the other one.
Anybody have any ideas that can help me?
This question already has answers here:
How to embed a Youtube video into my app?
(7 answers)
Closed 7 years ago.
Okay so I'm looking to play film trailers in my app. The user will press a button, and then it plays the video. I have added the import AVKit and import AVFoundation lines to my file. This is the code I have so far for making the video play:
#IBAction func playTrailerPressed(sender: AnyObject) {
let videoURL = NSURL(string: "https://youtu.be/d88APYIGkjk")
let player = AVPlayer(URL: videoURL!)
let playerViewController = AVPlayerViewController()
playerViewController.player = player
self.presentViewController(playerViewController, animated: true) {
playerViewController.player!.play()
}
}
This seems to launch an AVPlayerViewController, but doesn't play the video from YouTube. Instead, I get the below:
I have tried both the sharing and embedding link from YouTube, but neither work. If I use a link which has the video file name at the end, it plays it fine, for example: "https://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"- So I know the code works.
Does anyone know if this is possible to use this way with a YouTube video? (I have also tried trailers from IMDb and Apple, but it's the same).
Thanks for your help!
AVPlayer only plays movie files, and YouTube videos aren't directly exposed as movie files at their URL. It looks like the preferred way to handle YouTube videos is to embed a web view into your app. See this page for information from Google on how to do that.
I implemented Spotify in my application using CocoaLibSpotify library. I am playing spotify songs from different pages of my app. The problem is, after I played a song then when I try to play another song from another page, it plays the old song for some moments.
This is some code sample.
self.playbackManager = [[SPPlaybackManager alloc] initWithPlaybackSession:[SPSession sharedSession]];
self.playbackManager.playbackSession.playbackDelegate = (id)self;
[self.playbackManager playTrack:track callback:^(NSError *error)
{
if ((error || ([track availability] != SP_TRACK_AVAILABILITY_AVAILABLE)))
{
}
else
{
}
}];
Please help me to fix the issue.
It sounds like you're creating a new playback manager for each page of your app. Don't do this, or they'll overlap one another.
Have only a single playback manager in your whole app - that way, when you play a new track using playTrack:callback:, the new track will replace the old one instantly. Note that you do not set the currentTrack property directly - it's read-only.