Not sure where to post

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
cstambaugh
Blank Cone
Blank Cone
Posts: 11
Joined: 06 May 2016 16:25

Not sure where to post

Postby cstambaugh » 06 May 2016 17:06

Hello Everyone,

First, let me apologize. I am a complete noob at programming and languages. We did a hello world program in college, but that was the extent. Fast forward and I am now trying to play with programming.

I have been tasked with a project, and I usually can piece things together if I Google and find parts here and there, but this has left me empty handed, and a bunch less hair.
I need to build a simple program (in house ONLY) that is able to have 1 VLC plugin, for viewing, and several buttons to change the rtsp stream the viewer is seeing. I created one that opens new windows when you click buttons to show the streams, but that is not what they wanted after seeing it.

I know the string is something with:

string MRL { get; set; }

But I cannot find ANY examples of how it is used. I am using C# for the Windows form (maybe the wrong language?)

private void button1_Click(object sender, EventArgs e)
{
AxVLCPlugin2 set MRL = Stream

}

This is my button and referencing the plugin (default name ) How do I set the mrl on click?

I did not know where to post this and did not see a moderator listed active online so if I need to move it tell me and I will repost where it needs to be.

Thank you in advance.... and my hair thanks you... (its tired of being pulled out)

Chris

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: Not sure where to post

Postby da2424 » 23 May 2016 13:02

This should work:

Code: Select all

private void button1_Click(object sender, EventArgs e) { int idx = axVLCPlugin21.playlist.add("file:///c:/path/to/file/test.mp4"); axVLCPlugin21.playlist.playItem(idx); }
The property "MRL" should only be used for autoplay.

cstambaugh
Blank Cone
Blank Cone
Posts: 11
Joined: 06 May 2016 16:25

Re: Not sure where to post

Postby cstambaugh » 23 May 2016 13:06

I am using it for RTSP so autoplay should be fine.

We have several streams we want to switch between

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: Not sure where to post

Postby da2424 » 23 May 2016 13:27

For switching, you could do it like this:

Code: Select all

private void Form1_Load(object sender, EventArgs e) { axVLCPlugin21.playlist.add("file:///c:/path/to/file/1.mp4"); axVLCPlugin21.playlist.add("file:///c:/path/to/file/2.mp4"); axVLCPlugin21.playlist.add("file:///c:/path/to/file/3.mp4"); axVLCPlugin21.playlist.play(); //play the first video in playlist } private void button1_Click(object sender, EventArgs e) { axVLCPlugin21.playlist.next(); //next item in playlist }
So the first stream starts at opening of the window, and you can switch between your defined streams over a button.
Otherwise, you could define separate buttons for each video.

cstambaugh
Blank Cone
Blank Cone
Posts: 11
Joined: 06 May 2016 16:25

Re: Not sure where to post

Postby cstambaugh » 23 May 2016 14:04

What if they are not files, but IP streams? One button per stream?

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: Not sure where to post

Postby da2424 » 23 May 2016 14:58

What if they are not files, but IP streams? One button per stream?
IP streams will be added at the same way:

Code: Select all

axVLCPlugin21.playlist.add("http://127.0.0.1:1234");
If you want to have one button per stream, you could use this:

Code: Select all

private void button1_Click(object sender, EventArgs e) { axVLCPlugin21.playlist.playItem(0); } private void button2_Click(object sender, EventArgs e) { axVLCPlugin21.playlist.playItem(1); } ...

cstambaugh
Blank Cone
Blank Cone
Posts: 11
Joined: 06 May 2016 16:25

Re: Not sure where to post

Postby cstambaugh » 23 May 2016 15:06

Thank you, I am going to try this after I finish my current task. I will post back the results! Have a Great day!

Chris

cstambaugh
Blank Cone
Blank Cone
Posts: 11
Joined: 06 May 2016 16:25

Re: Not sure where to post

Postby cstambaugh » 23 May 2016 16:53

Well, that did not seem to work for me, I must be too lacking in my programming knowledge to understand why. Here is my code. Its just one Window and 3 buttons..

Code: Select all

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace RoomCameraSwitcher { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { axVLCPlugin21.playlist.add("rtsp://xxx.xxx.xxx/live3.sdp"); axVLCPlugin21.playlist.add("rtsp://xxx.xxx.xxx/live3.sdp"); axVLCPlugin21.playlist.add("rtsp://xxx.xxx.xxx/live3.sdp"); axVLCPlugin21.playlist.play(); //play the first video in playlist } private void button1_Click(object sender, EventArgs e) { axVLCPlugin21.playlist.playItem(0); } private void button2_Click(object sender, EventArgs e) { axVLCPlugin21.playlist.playItem(1); } private void button3_Click(object sender, EventArgs e) { axVLCPlugin21.playlist.playItem(2); } } }

I did remove the IP addresses for security and replaced them with xxx.xxx.xxx but they were actually working IP addresses when I tried it.

Any obvious things wrong? There is no errors on the Visual Studio Manager, but there is some yellow..

When I hover over the yellow it says the name of the VLC plugin and get set. The Yellow is over the playlist add section of the code

Thanks


Chris



****EDIT*****


The yellow is gone now... I dont know why.... But the buttons still dont change the stream..
DO I have to add a number to the streams like axVLCPlugin21.playlist.add 1("rtsp://xxx.xxx.xxx/live3.sdp"); instead of axVLCPlugin21.playlist.add("rtsp://xxx.xxx.xxx/live3.sdp");??

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: Not sure where to post

Postby da2424 » 24 May 2016 12:20

Are the event handlers registered in the file Form1.Designer.cs?

For the buttons, there should be an command like this:

Code: Select all

// // button1 // ... ... this.button1.Click += new System.EventHandler(this.button1_Click);
Same for Form1_Load():

Code: Select all

// // Form1 // ... ... this.Load += new System.EventHandler(this.Form1_Load);

cstambaugh
Blank Cone
Blank Cone
Posts: 11
Joined: 06 May 2016 16:25

Re: Not sure where to post

Postby cstambaugh » 24 May 2016 15:50

For the buttons, yes there is

Code: Select all

this.button2.Location = new System.Drawing.Point(529, 714); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 2; this.button2.Text = "button2"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click);
For the VLC plugin there is a little different code..

Code: Select all

this.axVLCPlugin21.Enabled = true; this.axVLCPlugin21.Location = new System.Drawing.Point(183, 60); this.axVLCPlugin21.Name = "axVLCPlugin21"; this.axVLCPlugin21.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axVLCPlugin21.OcxState"))); this.axVLCPlugin21.Size = new System.Drawing.Size(971, 551); this.axVLCPlugin21.TabIndex = 0; this.axVLCPlugin21.Enter += new System.EventHandler(this.axVLCPlugin21_Enter);

For the form 1 load it looks like this:

Code: Select all

// Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1298, 889); this.Controls.Add(this.button3); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.axVLCPlugin21); this.Name = "Form1"; this.Text = "Form1"; ((System.ComponentModel.ISupportInitialize)(this.axVLCPlugin21)).EndInit(); this.ResumeLayout(false);

Thank you for your help, it is REALLY MUCH appreciated... I am so lost in this project, I feel like a fish out of water..

Chris

cstambaugh
Blank Cone
Blank Cone
Posts: 11
Joined: 06 May 2016 16:25

Re: Not sure where to post

Postby cstambaugh » 25 May 2016 13:30

Ok so I GOT IT WORKING!!

I know it is not much but it is a HUGE accomplishment for me!!

I have Multiple streams one window and the buttons switch the streams... Video quality rocks and sound is awesome... AND with the vlc plugin allows the individual selected screen to go fullscreen as well, with volume controls...


da2424 I can't thank you enough for your help! I was working on this for over a month before I posted here...

Chris

jumpier
New Cone
New Cone
Posts: 1
Joined: 27 Jun 2017 12:07

Re: Not sure where to post

Postby jumpier » 27 Jun 2017 12:18

Hi to everybody

i've write a c# program using VLC for browsing a camera by RSTP connection on DVR. This is my code to add a camera to vlc playlist (from a DVR station with 16 ports)

axVLCPlugin21.playlist.add("rtsp://admin:admin@192.168.120.123:554/cam/realmonitor?channel=1&subtype=0"); // Camera 1
...
axVLCPlugin21.playlist.add("rtsp://admin:admin@192.168.120.123:554/cam/realmonitor?channel=16&subtype=0"); // Camera 16

If the DVR is switched off or unplugged from the ethernet network, my application frozen for some second; is possible "catch"this error using the vlc reference (axVLCPlugin21 object)? Any suggestions or workarounds?


Thanks a lot to everybody

da2424
Cone that earned his stripes
Cone that earned his stripes
Posts: 310
Joined: 16 Apr 2013 16:57

Re: Not sure where to post

Postby da2424 » 03 Jul 2017 21:52

I think it hangs at axVLCPlugin21.playlist.play(), right?
The easiest way would be to ping the server before you start the playlist, I think.

Btw: Please do not recycle old threads for new issues ;)


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 20 guests