How do I change a video stream?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Happycamper8

I have a video player which works fine. However, I need it to play a different video.
To troubleshoot my code I print out and do the following:

1.) I print the stream.resource path and it prints the original stream file path.
2.) I print out the stream.get_file() which prints the original stream file path.
3.) I use “stream.set_file(new_video_path)” to set the stream to the new video I want to play.
4.) I print the stream.resource path again and it prints the original stream file path.
5.) I print stream.get_file() and it prints the new video I want to play.
6.) I play the video and it plays the original video not the new one.

The resource path remains the original however I did try setting the resource path directly also and when I try that it goes to an empty string, but the original video still plays.

How can I swap out the video so I can play something different? Using another video player is not the best option as I may have many videos and it will become a huge pain. Also, videos may be added later and it needs to be dynamic.

:bust_in_silhouette: Reply From: Happycamper8

I found the solution in case anybody else has the issue.

I don’t do the stream.set_file(newvideopath) anymore at all.
I add instead videoplayer.stream = load(newvideopath)
That allows the video to play the new video.