I have written code for playing youtube videos in webbrowser.
Xaml code:
<phone:WebBrowser x:Name="webBrowser" Height="411" IsScriptEnabled="True" Margin="10,100,78,0" />
Xaml.cs code:
Movie movie;
public VideoPage()
{
InitializeComponent();
var app = App.Current as App;
movie = app.selectedMovie;
string video =movie.MovieWatchLink;
this.webBrowser.Navigate(new Uri(video));
}
When I run this code at first white color PhotoFrame is displaying as shown in below figure.
And when we tap it.Movie starts playing in nativeplayer.And when we want to move back to movies list also this photoframe is displaying.
Please anybody help me how can I remove this.I searched my level best eventhough I didnt get any solution. Please help me how can I immediately play after selecting the movie.
ManyThanks in Advance
You can try collapsing the visibility of the webBrowser until the video starts streaming in the native player if we can get any handle of media being played in our code.or else you can try showing a thumbnail image related to the video until it starts to stream in player.
Showing thumbnail will be a better choice.
Regards,
Ganesan S
Related
I'm working on a tour in webvr and using a-frame to build it. I have a bizarre problem. I seem to be able to get aframe to play a video inside a videosphere and correctly display every second of it the first time I enter a new scene, but whenever I exit from it and try to enter it again, only the sound works as supposed. I'm wondering if I'm doing something wrong in the loading of the video or something
I'm collecting the path to the video from a json file in which I describe what each rooms contains (they may have interactable pins for 16:9 video, images and the sort, and also pins that simply load a new scene).
After loading the json, I set the source of the videosphere, name image360, as such:
document.getElementById("image360").setAttribute('src', "#" + jsonArray.zones[zoneID].locations[locationID].name);
I then play the video using the following code :
video = document.querySelector('#' + jsonArray.zones[zoneID].locations[locationID].name);
video.muted = false;
video.addEventListener("ended", videoEnded);
video.play();
The event listener I add to the video takes care of taking the user back to the previous scene once the video ends, which I do using this code:
//This function is called immediately after the end of a 360 video. Thus it first starts by obtaining the scene it should load after the end of the scene
var thisEl = document.querySelector('#' + jsonArray.zones[zoneID].locations[locationID].name);
var currentLocation = jsonArray.zones[zoneID].locations[locationID];
var locationToReturnTo = currentLocation.locationToReturnTo;
var zoneToReturnTo = currentLocation.zoneToReturnTo;
//With the information obtained, the room is then loaded
generateRoom(zoneToReturnTo, locationToReturnTo);
//After loading the room, time to generate the correct pins
generatePins(zoneToReturnTo, locationToReturnTo);
I'm truly at a loss here, and have no idea why this doesn't work. I should note that javascript and aframe are not my area of expertise at all, I just had to pick up this project after a former colleague of mine, who was working on it, left the company abruptly, so excuse me if I'm making a basic mistake.
Thanks in advance.
Switching videos directly on a entity may not work properly:
document.querySelector("a-video").setAttribute("src", "vid.mp4")
because of the current tmp <video> handling.
You should try using the assets management system:
<a-assets>
<video id="vid" src="derby.mp4"></video>
</a-assets>
<!-- Scene. -->
<a-plane src="#vid"></a-plane>
JS
(#vid).setAttribute("src", "newvid.mp4")
OK, I have seen a lot of questions and answers on how to code pause/resume buttons, but none of them fit my specific need. First let me explain what I have:
I have made a tutorial video for my job. It consists of screens shots and sounds. I have a forward button that skips to the next section (usually the start of the next audio file) and a back button that goes to the previous section. However I need a pause button.
Now let me explain how I have built it:
I have made the movie at 1fps. I have a layer for Audio, a layer for the screen shots, a layer for each button, and various other layers for highlighting things in the screen shots. On the Audio layer I placed my audio file on the stage and then dragged out the number of frames until the entire audio file could play uninterrupted. So if the audio was 10 seconds long, it lives across 10 frames. I can then put my screenshot on its own layer and do the same so that the image displays the same length of time as the audio. When the frame ends, it automatically skips to the next frame and continues on until the end. Since the audio is on the stage, the viewer doesn't need to do anything to get the audio to play.
After viewing many tutorials, it seems like most people use code to get the audio to play rather than putting it on the stage. I am not this skilled.
So my question is, with my current set up, how can I make a toggle button that basically says "If audio is playing, stop the whole show when clicked- if audio is not playing, resume show from last position when clicked"?
Thank you so much if you can help! Also, this is my first time asking a technical question like this, please let me know if you need any other specific details.
First make sure all audios on your timeline are set to "Stream". To
do this click on the frame where your audio lies, find the sound
panel, change it from Event to Stream. this will ensure that when
the timeline is stopped the audio stops and resumes when the
timeline is played.
As for the buttons simply make one that calls stop() on the timeline and one that calls play(). This will stop the timeline wherever it is and resume it on play.
var myTimeline:MovieClip;//link to the movieclip where your timeline animation lies
var btnPause:SimpleButton;//link to your pause button
btnPause.addEventListener(MouseEvent.CLICK,function(event:MouseEvent):void{
myTimeline.stop();
});
var btnResume:SimpleButton;//link to your resume button
btnResume.addEventListener(MouseEvent.CLICK,function(event:MouseEvent):void{
myTimeline.play();
});
I'm a begginer, and I need your help :)
I have a simple landing page, made from one long jpg + image mapping.
I've embedded a youtube video in a specific location on the image as an object command but I want to show a different image until it is pressed (an image with a play button, for example).
The page will be shown on a facebook tab as well.
Can any1 help me?
P.S - Sorry if I have grammar mistakes :)
Thanks!
Pretty sure a placeholder can be implemented via the Youtube API or you could take a look at this, How to add a splash screen/placeholder image for a YouTube video
Using JavaScript: You could add a Listener to the image so once it is pressed it loads a video.
var image = new Image(); //Image with playbutton
//Then load your Video in the EventListener
image.onclick("load", function() {
alert("loaded");
The function() method will contain the code to run your video
This is a good link about EventListeners http://idratherbewriting.com/javascript/events-and-listeners-javascript/
I'm currently making a game and everything is going fine except for one simple thing. I'm having a problem with my app sound. When I touch the "Start" Button to play the game, it presents a new View Controller with the game itself and it plays a song. I have another view controller with its settings. Inside it, I have a UISwith that mutes the App. My problem is that when I dismiss that view controller it does not save its state. I tried NSUserDefauts and could not get it working. Maybe I'm not doing it right... If you could help me I would be very appreciated!
Also, I have multiple a AVAudioPlayer (one for the game, another for when the user wins or loses) is there a way to just completely mute the entire app instead of muting every single AVAudioPlayer one at a time?
Thank you so much!
Regarding muting the sound:
- (IBAction)speakerOnOff:(id)sender
{
static BOOL muted = NO;
if (muted) {
[player setVolume:1.0];
} else {
[player setVolume:0.0];
}
muted = !muted;
}
If you have multiple AVAudioPlayer just access the properties of all and setVolume:0.0.
I'm tearing my hair out trying to add controls such as pause and volume to my Chromeless Youtube Player in Flash with actionscript 3, tried working with the reference that google provide but it still doesn't work. Here's what I tried, can anyone tell me where I'm going wrong?
function pauseVideo() {
if (player) {
player.pauseVideo();
}
}
pauseBtn.addEventListener(MouseEvent.CLICK,pauseVideo);
Thanks
How I understand you are trying to integrate youtube's player into your application. Take a look at this example it may help you and check with the documentation if you are loading correctly their player and it's fully loaded when you are trying to access it, first example
*I would like to help you more but I don't know how you instantiate the player