Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how do I abort a video while it is playing #28

Open
rclancy opened this issue Oct 7, 2023 · 6 comments
Open

how do I abort a video while it is playing #28

rclancy opened this issue Oct 7, 2023 · 6 comments

Comments

@rclancy
Copy link

rclancy commented Oct 7, 2023

I have a Blazor web application that passes byte arrays to BlazoredVideo but when I want to change the source, the application freezest. How can I abort the current video so I can change the source?

@chrislangston
Copy link

I'm not sure your specific use case, but I'll share how I'm doing this.

I have a playlist of videos that the user can see in a panel on the right side of the webpage. When a video is playing and it reached the end, it will automatically queue up the next video and begin to auto play. Or if the user clicks a new link in the playlist, I will adjust bound properties.

I adjust the correct properties bound to the BlazoredVideo component and then make the following calls:
await MyBlazorVideo.ReloadControl();
await MyBlazorVideo.StartPlayback();

        <BlazoredVideo @ref="MyBlazorVideo"
                       TimeUpdateEvent="OnEvent"
                       Play="OnPlay"
                       Ended="OnEnded"
                       VideoEventOptions="options"
                       class="w-100"
                       autofocus="true"
                       controls="controls">
            <source src="@VideoSource" type="video/mp4" />
        </BlazoredVideo>

@rclancy
Copy link
Author

rclancy commented Jun 19, 2024 via email

@chrislangston
Copy link

chrislangston commented Jun 20, 2024 via email

@rclancy
Copy link
Author

rclancy commented Jun 20, 2024 via email

@chrislangston
Copy link

Hi @rclancy ,

Take a look at the sample repo that I pushed for an example. This is just a clone of the main repo with a few changes to show the example. Note, I'm not doing anything with byte arrays, but rather just changing the value that is bound to "VideoSource"

See the file in "SharedRCL/Pages/Controls/razor". I created a sample button that when the user clicks, it will change the value for @VideoSource and then just call "video.ReloadControl()". If you want it to start playing, you can call video.StartPlayback().

https://github.com/chrislangston/Blazored.Video

@rclancy
Copy link
Author

rclancy commented Jun 21, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants